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? Link to comment https://forums.phpfreaks.com/topic/59643-solved-mysql-syntax-error/ 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 Link to comment https://forums.phpfreaks.com/topic/59643-solved-mysql-syntax-error/#findComment-296391 Share on other sites More sharing options...
ballhogjoni Posted July 12, 2007 Author Share Posted July 12, 2007 ok Link to comment https://forums.phpfreaks.com/topic/59643-solved-mysql-syntax-error/#findComment-296397 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) Link to comment https://forums.phpfreaks.com/topic/59643-solved-mysql-syntax-error/#findComment-296414 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')"; Link to comment https://forums.phpfreaks.com/topic/59643-solved-mysql-syntax-error/#findComment-296449 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.