Hi all, I'm facing this error while following a tutorial.
Warning: mysqli_result::fetch_array() expects parameter 1 to be integer, string given in C:\xampp\htdocs\client\login.php on line 12
[]
Here is my php
<?PHP
include_once("connection.php");
if( isset($_GET['format']) && $_GET['format'] == "json" ) {
$query = "SELECT * FROM tbl_client " ;
$result = mysqli_query($conn, $query)
or die("Error: ".mysqli_error($conn));
$myArray = array();
while($row = $result -> fetch_array('MYSQL_ASSOC')) {
$myArray[] = $row;
}
echo json_encode($myArray);
$result->close();
exit;
}
echo "add <i>?format=json</i> the end of the URL";
?>