Re: [PHP] [php] if $sql has returned something

2004-02-25 Thread John Taylor-Johnston
Very helpful & much appreciated. Richard Davey wrote: > Hello John, > > Wednesday, February 25, 2004, 6:26:41 PM, you wrote: > > JTJ> Richard, > JTJ> Thanks. Should I still include the die ? > > JTJ> $glquery = mysql_query($sql) or die("Invalid query: " . mysql_error()); > > It's up to you, I nev

Re[2]: [PHP] [php] if $sql has returned something

2004-02-25 Thread Richard Davey
Hello John, Wednesday, February 25, 2004, 6:26:41 PM, you wrote: JTJ> Richard, JTJ> Thanks. Should I still include the die ? JTJ> $glquery = mysql_query($sql) or die("Invalid query: " . mysql_error()); It's up to you, I never do. It won't give you a very clean exit if an error occurs. -- Best

Re: [PHP] [php] if $sql has returned something

2004-02-25 Thread John Taylor-Johnston
Richard, Thanks. Should I still include the die ? $myconnection = mysql_connect($server,$user,$pass); mysql_select_db($db,$myconnection); $eventid = $link_date; $sql = 'SELECT * FROM '.$table.' where eventid like \''.$eventid.'\';'; $glquery = mysql_query($sql) or die("Invalid query: " . mysql_e

Re: [PHP] [php] if $sql has returned something

2004-02-25 Thread John Taylor-Johnston
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 fal

Re: [PHP] [php] if $sql has returned something

2004-02-25 Thread Jason Wong
On Thursday 26 February 2004 01:53, John Taylor-Johnston wrote: > Here is my code. $sql works correctly, but am not sure I did this line > correct: Your query ($sql) is incorrect and will not work. See manual for why. > $glquery = mysql_query($sql); > > because "if ($glquery)" always returns som

Re[2]: [PHP] [php] if $sql has returned something

2004-02-25 Thread Richard Davey
Hello John, Wednesday, February 25, 2004, 5:53:13 PM, you wrote: JTJ> Here is my code. $sql works correctly, but am not sure I did this line correct: JTJ> $glquery = mysql_query($sql); JTJ> because "if ($glquery)" always returns something. I want to know if it returns NULL. mysql_query will ret

Re: [PHP] [php] if $sql has returned something

2004-02-25 Thread BAO RuiXian
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

Re: [PHP] [php] if $sql has returned something

2004-02-25 Thread John Taylor-Johnston
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_c

Re: [PHP] [php] if $sql has returned something

2004-02-25 Thread Jason Wong
On Thursday 26 February 2004 01:31, John Taylor-Johnston wrote: > I'm trying to figure out something. I found some calendar making code. For > each table cell, I want to add $day around $day if an entry > exists in $db.$table > > $sql = 'SELECT * FROM '.$db.'.'.$table.' where eventid like '.$eventi

Re: [PHP] [php] if $sql has returned something

2004-02-25 Thread BAO RuiXian
John Taylor-Johnston wrote: I'm trying to figure out something. I found some calendar making code. For each table cell, I want to add $day around $day if an entry exists in $db.$table $sql = 'SELECT * FROM '.$db.'.'.$table.' where eventid like '.$eventid.';'; if ($sql ??) This will do:

[PHP] [php] if $sql has returned something

2004-02-25 Thread John Taylor-Johnston
I'm trying to figure out something. I found some calendar making code. For each table cell, I want to add $day around $day if an entry exists in $db.$table $sql = 'SELECT * FROM '.$db.'.'.$table.' where eventid like '.$eventid.';'; if ($sql ??) {echo "$day"; }else{ echo "$day"; } How do I code