How can I check mysqli query if it returns boolean(false) or the result? If I try getting the num_rows I get php error because I'm trying to access a non object as object. But I need to check this because if its false I have to set a variable and if its not than get the result of the query.
my query looks like this:
<?php
$q = "SELECT `id` FROM `table` ORDER BY `id` DESC LIMIT 0, 1";
$res = mysqli->query($q);
?>