Re: [PHP] mysql if empty



An empty result is still a valid result. As long as the SQL statement is valid, you will get a result set. This doesn't meant that the variable holding the reference to the result set is itself empty, but that you will fail to fetch any results from it.

Satyam

----- Original Message ----- From: <chris@xxxxxxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Monday, April 09, 2007 11:18 PM
Subject: [PHP] mysql if empty


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";


----- Original Message ----- From: "Martin Marques" <martin@xxxxxxxxxxxxxxx>
To: "Stut" <stuttle@xxxxxxxxx>
Cc: "Tijnema !" <tijnema@xxxxxxxxx>; "tedd" <tedd@xxxxxxxxxxxx>; "Peter Lauri" <lists@xxxxxxxxxxx>; "Ólafur Waage" <sinai@xxxxxxxxx>; <php-general@xxxxxxxxxxxxx>
Sent: Monday, April 09, 2007 9:45 PM
Subject: Re: [PHP] Session Authentication


Stut escribió:
As with most things these days it probably breaches the DMCA. But frankly speaking, if doing that works then the developers of the application, and by extension the company, deserve everything they get.

DMCA is a real piece of crap.

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
---------------------------------------------------------
Martín Marqués | Programador, DBA
Centro de Telemática | Administrador
Universidad Nacional
del Litoral
---------------------------------------------------------

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




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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 269.0.0/752 - Release Date: 08/04/2007 20:34


.



Relevant Pages

  • Re: [PHP] Re: isset($a->b) even if $a->b = null
    ... mysql_fetch_objectfor instance you have just a stdobject, ... are considered "empty". ... PHP General Mailing List ... To unsubscribe, visit: http://www.php.net/unsub.php ...
    (php.general)
  • Re: [PHP] POST + QUERY
    ... Why not echo out your query before executing it, so you can run it against the back end if you have it, or at least for a sanity check to make sure you are running the correct query. ... If form is left empty, it is set, but it's stil empty. ... > PHP General Mailing List ... > To unsubscribe, visit: http://www.php.net/unsub.php ...
    (php.general)
  • Re: [PHP] POST + QUERY
    ... No matter ... If form is left empty, it is set, but it's stil empty. ... > PHP General Mailing List ... > To unsubscribe, visit: http://www.php.net/unsub.php ...
    (php.general)
  • Re: [PHP] Re: isset($a->b) even if $a->b = null
    ... var $b; ... are considered "empty". ... PHP General Mailing List ... To unsubscribe, visit: http://www.php.net/unsub.php ...
    (php.general)
  • mysql if empty
    ... If I search for something in mysql that returns an empty result I cant get it to return ... echo "No result found"; ... PHP General Mailing List ...
    (php.general)