PHP mysqli fetch_array() Function
by tutorialsw3.com - May 23, 2019
Definition and Usage
The fetch_array() / mysqli_fetch_array() function fetches a result row as an associative array, a numeric array, or both.
Note: Fieldnames returned from this function are case-sensitive.
Syntax
Object oriented style:
Procedural style:
Example - Object Oriented style
Fetch a result row as a numeric array and as an associative array:
Read more on: PHP mysqli Tutorial free online<?php
$mysqli = new mysqli("localhost","my_user","my_password","my_db");
if ($mysqli -> connect_errno) {
echo "Failed to connect to MySQL: " . $mysqli -> connect_error;
exit();
}
$sql = "SELECT Lastname, Age FROM Persons ORDER BY Lastname";
$result -> $mysqli -> query($sql);
// Numeric array
$row = $result -> fetch_array(MYSQLI_NUM);
printf ("%s (%s)\n", $row[0], $row[1]);
// Associative array
$row = $result -> fetch_array(MYSQLI_ASSOC);
printf ("%s (%s)\n", $row["Lastname"], $row["Age"]);
// Free result set
$result -> free_result();
$mysqli -> close();
?>
mysqli_fetch_array using a foreach loop
mysqli_query, mysqli_fetch_array and while loop
Output of mysqli_fetch_array($data) with loop
mysql_fetch_array and while loop in php
mysqli_fetch_array vs mysqli_fetch_assoc
mysqli_fetch_array error, mysqli_fetch_array row count, mysqli_fetch_array number of rows

The site is addressed to people who want to get started in web programming. Careful! PHP means programming. It is true that a web developer must have a minimum knowledge of web design (HTML, CSS, JavaScript and others), but this site only deals with programming issues.
css | Css rounded corners |
html | Html input size |
css | Css background image opacity |
css | Css background image size to fit screen |
php-mysqli | Mysqli_fetch_array |
html | Html div style class tutorial |
- Paphos, Larnaca, Limassol, Nicosia. Ce-i de vizitat
- Paphos, Larnaca, Limassol, Nicosia. Ce-i de vizitat
- Paphos, Larnaca, Limassol, Nicosia. Ce-i de vizitat
- Paphos, Larnaca, Limassol, Nicosia. Ce-i de vizitat