ballhogjoni Posted July 12, 2007 Share Posted July 12, 2007 what is wrong with this statemnet: $query = 'SELECT * FROM products WHERE id = '.$id.' AND boy = '.$boyGirl.' OR girl = '.$boyGirl; what do i do to fix it? Quote Link to comment Share on other sites More sharing options...
per1os Posted July 12, 2007 Share Posted July 12, 2007 $query = 'SELECT * FROM products WHERE id = '.$id.' AND (boy = '.$boyGirl.' OR girl = '.$boyGirl.')'; You need parenthesis's around the "OR" statement Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted July 12, 2007 Author Share Posted July 12, 2007 ok Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted July 12, 2007 Author Share Posted July 12, 2007 I get this error? Operand should contain 1 column(s) Quote Link to comment Share on other sites More sharing options...
trq Posted July 12, 2007 Share Posted July 12, 2007 I think you need to group the last part. eg; $query = "SELECT * FROM products WHERE id = '$id' AND (boy = '$boyGirl' OR girl = '$boyGirl')"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.