What will the $result be when MySQL returns nothing?
Posted
by Teddy
on Stack Overflow
See other posts from Stack Overflow
or by Teddy
Published on 2010-04-10T16:59:38Z
Indexed on
2010/04/10
17:03 UTC
Read the original article
Hit count: 297
This might seem ridiculously simple, but I've been getting all kinds of error depending on how I handle a query that returns nothing.
$query = "SELECT * FROM messages WHERE id > ".$messageId;
$result =mysql_query($query);
$time = time();
while(time()-$time<60 && $result==false)
{
$result = mysql_query($query);
}
if(result != false)
//Encode response
else
//return nothing
How do I check whether my mysql_query() returned anything?
© Stack Overflow or respective owner