Syntax:
mysqli_fetch_array ("database_name", "mode")
Parameters: This function accepts two parameters as mentioned above and described below:
<?php
$conn = mysqli_connect(
"localhost", "root", "", "Persons");
// Check connection
if (mysqli_connect_errno()) {
echo "Database connection failed.";
}
$sql = "SELECT Lastname, Age FROM Persons ORDER BY Lastname";
$result -> $mysqli -> query($sql);
// Numeric array
$row = mysqli_fetch_array($conn, MYSQLI_NUM);
printf ("%s (%s)\n", $row[0], $row[1]);
printf("\n");
// Associative array
$row = mysqli_fetch_array($conn, MYSQLI_ASSOC);
printf ("%s (%s)\n", $row["Firstname"], $row["Lastname"]);
mysqli_close($conn);
?>