I noticed that a lot of tutorial instructions often have this code:
$sql="SELECT * from table";
$num=mysql_num_rows();
if ($num > 0)
{
do something
}
Why do they have to use that condition "if ($num > 0)" when I write this code that I think is compact and readable:
$sql="SELECT * from table";
$itExists=mysql_num_rows();
if ($itExists)
{
do something
}
does mysql_num_rows ever return a negative integer? Doesn't PHP always equate 0 to false? I've used this approach and noticed nothing different or unusual.