Re: mmmmm SELECT

From: Date: Tue, 07 Jan 2003 00:44:19 +0000
Subject: Re: mmmmm SELECT
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-130520@lists.php.net to get a copy of this message
At 04:27 PM 1/6/03 , Bruce Levick wrote:
I have this silly problem. This select query works fine. #################################################### $query_retrievetasks = "SELECT * FROM tasks, users WHERE tasks.UID = users.User_id ORDER by tasks.ID"; #################################################### But when I add a further filter (AND active="yes") ....it comes up blank...currently all the active rows in the tasks table are equal to "yes" so they should still display, but comes up with a blank. #################################################### $query_retrievetasks = "SELECT * FROM tasks, users WHERE tasks.UID = users.User_id AND active="yes" ORDER by tasks.ID"; #################################################### Can't understand this, is it just something simple I am missing??
If this is the query you are actually using, it is causing a PHP syntax error due to the nested double-quotes. Use $query_retrievetasks = "SELECT * FROM tasks, users WHERE tasks.UID = users.User_id AND active='yes' ORDER by tasks.ID"; Note the single-quotes around 'yes'. I'm guessing your installation is set up to not echo PHP errormessages back to the screen, that's why you didn't see an error message.
        -steve
+------------------------------------------------------------------------+
| Steve Edberg                                      sbedberg@ucdavis.edu |
| Database/Programming/SysAdmin                            (530)754-9127 |
| University of California, Davis             http://pgfsun.ucdavis.edu/ |
+---------------------- Gort, Klaatu barada nikto! ----------------------+

« previous php.general (#130520) next »