I\'m looking for the best way to check and see if any results were returned in a query. I feel like I write this part of code a lot and sometimes I get errors, and sometimes
$connect = new mysqli('localhost', 'user', 'password', 'db'); $result = $connect->query("select * from ..."); $count=$result->num_rows; if(empty($count)){ echo"Query returned nothing"; } else{ echo"query returned results"; }