I have the following mysql query that returns data in a JSON. What’s the best way to check if there are 0 records, and return that fact?
$row_num = mysql_num_rows($rslt);
$data = array();
while ( $row = mysql_fetch_row($result) )
{
$data[] = $row;
}
echo json_encode( $data );
1 Answer