I'm running PHP
and MySQL
and have the following code:
$data = array();
$result = mysql_query($search_query);
if ($result){
while($row = mysql_fetch_assoc($result)) {
$data[] = $row;
}
if (sizeof($data) > 0) {
//var_dump($data);
echo json_encode($data);
} else {
echo 'empty';
}
}
If my query has no rows I do get empty
returned.
But if there's any records I get a Resource has no content
in Safari.
But if I uncomment my //var_dump($data);
then I do get a nice array of values.