I'm trying to make a message if there are no results to show from mysqli result:
$result = $stmt->get_result();
// I tried many things like this before the while
if (empty($stmt->get_result())) {
// message here
}
// or
if (!$stmt->get_result()) {
// message here
}
while ($row = $result->fetch_array()) {
// do something
}
//Also after the while
if (empty($result->fetch_array())) {
// message here
}
// or
if (!$result->fetch_array()) {
// message here
}
But nothing works, I get the while printing data and the message also displaying... or not displaying nothing.
What is the correct way?
Thanks!