Re: [php] if $sql has returned something

From: Date: Wed, 25 Feb 2004 17:53:13 +0000
Subject: Re: [php] if $sql has returned something
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-178861@lists.php.net to get a copy of this message
Bao or anyone, Here is my code. $sql works correctly, but am not sure I did this line correct: $glquery = mysql_query($sql); because "if ($glquery)" always returns something. I want to know if it returns NULL. Thanks for your time, John -----------snip----------------- $myconnection = mysql_connect($server,$user,$pass); mysql_select_db($db,$myconnection); $eventid = $link_date; $sql = 'SELECT * FROM '.$table.' where eventid like '.$eventid.';'; #echo $sql; #SELECT * FROM GMCalendar where eventid like 2004-02-16; $glquery = mysql_query($sql); if ($glquery) { echo "<td><a href=results.php?eventid=$link_date> $day </a></td>"; }else{ echo "<td> $day </td>"; } Bao Ruixian wrote: > John Taylor-Johnston wrote: > >$sql = 'SELECT * FROM '.$db.'.'.$table.' where eventid like > >'.$eventid.';'; > >if ($sql ??) > This will do: > if ($sql)

« previous php.general (#178861) next »