Em Segunda 09 Abril 2007 18:27, Lori Lay escreveu: > 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 $result is set ($result = mysql_query($query))... compare to 0 is satisfatory: $result=mysql_query($query) $results=mysql_num_rows($result) if($results==0) { echo "no result found"; } elseif($results<0) { echo "Some error? ".mysql_error(); } else { //your code here } -- Davi Vidal davividal@xxxxxxxxxxxxxxxx davividal@xxxxxxxxx -- Agora com fortune: " I imagine bugs and girls have a dim perception that nature played a cruel trick on them, but they lack the intelligence to really comprehend the magnitude of it. -- Calvin" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php