Re: mysql if empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



chris@xxxxxxxxxxxx wrote:
If I search for something in mysql that returns an empty result I cant get it to return "No result found" always returns "Found" even though the recoed does not exist...


$sql = "SELECT Client FROM booked WHERE Name = 'larry'";

$result = mysql_query($sql);

if ($result == "")
{
echo "No result found";
}
echo "Found";

Use isset.

if (!isset($result)) {
   echo "No result found";
}...

Lori

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux