Is it possible to somehow use list
and mysqli_fetch_row
together? The code below doesn't work.
$query = "SELECT id, email FROM emails WHERE id='24'";
$result = mysqli_query($link, $query);
list($get_id, $get_email) = mysqli_fetch_row($result);
This code however works, but I want a code that is less lines:
$query = "SELECT id, email FROM emails WHERE id='24'";
$result = mysqli_query($link, $query);
$row = mysqli_fetch_row($result);
$get_id = $row[0];
$get_email = $row[1];
You can use the list()
like that.
So there must be an error in your query or somewhere else in your code, so add this code to be sure if there is an error and if so what it is.
error_reporting(E_ALL);
ini_set('display_errors', 1);
$query = "SELECT id, email FROM emails WHERE id='24'";
$result = mysqli_query($link, $query);
if ( ! $result ) {
echo mysqli_error($link);
exit;
}
list($get_id, $get_email) = mysqli_fetch_row($result);