I have a piece of PHP code I am using to grab the 20 next messages in a database.
<?php
$user_email_msg = "bob@gmail.com";
$msg_email = "sam@gmail.com";
$start_query_msg = 1;
$end_query_msg = $start_query_msg-20;
$user_link_msg = mysqli_connect("localhost", "root", "admin", $user_email_msg);
$query_msg = "SELECT * FROM " . $msg_email . " WHERE id BETWEEN " . (string)$end_query_msg . " AND " . (string)$start_query_msg;
$result_msg = mysqli_query($user_link_msg, $query_msg);
$row_msg = mysqli_fetch_all($result_msg, MYSQLI_NUM);
$next_20 = $row_msg[0];
print_r($next_20);
?>
When I run this code I get this error message:
"Warning: mysqli_fetch_all() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\jayden\messages.php on line 10"
I am so lost here, because I can't see any way that $result_msg
can be returning a boolean value.
How can I fix the issue?