I know this question has been asked many times before. But each one seems to always have pointed to a failed MySQL query and suggests to check the mysql_query() results.
However I do check the results, and the query returns a resource with two rows. Additionally I ran the query from my command line and it also returns two rows. What am I missing.
$query = "SELECT * FROM sleep WHERE date='2016-08-21'";
$result = mysql_query($query);
if($result) {
die("Database query failed");
} else {
echo "success";
}
if( mysql_num_rows($result) == FALSE) {
$mode = "print";
} else {
$mode = "edit";
}
echo $mode;