Re: [php] if $sql has returned something
| From: | BAO RuiXian | Date: | Wed, 25 Feb 2004 18:00:52 +0000 |
| Subject: | Re: [php] if $sql has returned something | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-178864@lists.php.net to get a copy of this message | ||
John Taylor-Johnston wrote:
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. Gee, I was goofed up by your last $sql:) Now you can check if it returns NULL byif (!$glquery) Best Bao
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: