Bao, I have only one entry where eventid = 2004-02-28. if (!$glquery) does not result in anything either.
Jason, Where in the manual would I look? I looked at http://www.php.net/manual/en/function.mysql-query.php but don't find anything inspiring. It does not die, so I can't check if it is false or true this way. $sql = 'SELECT * FROM '.$table.' where eventid like \''.$eventid.'\';'; $glquery = mysql_query($sql) or die("Invalid query: " . mysql_error()); #echo $sql; if (!$glquery) { echo "<td width=100 height=100 align=left valign=top>..<a href=results.php?eventid=$link_date> $day </a></td>"; }else{ echo "<td width=100 height=100 align=left valign=top> $day </td>"; } > >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 by > if (!$glquery) > > >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 ----------------------------------------------------------------------------- "If it's not Open Source, it's Murphy's Law or broken." ' ' ' Collège de Sherbrooke ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ - Université de Sherbrooke http://compcanlit.ca/ 819-569-2064 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php