stevew Posted July 8, 2012 Share Posted July 8, 2012 I have simplified my radio button request below: <form name="myform" action="apple.php"> <input type="radio" name="apple" value="apple"> apple<br> <input type="submit" value="submit" name="submit"> </form> <form name="myform" action="banana.php" method="POST"> <input type="radio" name="banana" value="banana"> banana<br> <input type="submit" value="submit" name="submit"> </form> output for apple.php $result = mysql_query("SELECT * FROM tbl WHERE apple LIKE 'yes%' ") output for banana.php $result = mysql_query("SELECT * FROM tbl WHERE banana LIKE 'yes%' ") How can I create an apple-banana.php ? $result = mysql_query("SELECT * FROM tbl WHERE apple && banana LIKE 'yes%' ") thanks. Link to comment https://forums.phpfreaks.com/topic/265382-select-statement-with-to-combine-results/ Share on other sites More sharing options...
jcbones Posted July 8, 2012 Share Posted July 8, 2012 $result = mysql_query("SELECT * FROM tbl WHERE apple LIKE 'yes%' AND banana LIKE 'yes%' ") Link to comment https://forums.phpfreaks.com/topic/265382-select-statement-with-to-combine-results/#findComment-1360047 Share on other sites More sharing options...
hakimserwa Posted July 8, 2012 Share Posted July 8, 2012 this should help you $result = mysql_query("SELECT * FROM tbl WHERE banana LIKE ='yes%' AND banana LIKE = 'yes%' "); Link to comment https://forums.phpfreaks.com/topic/265382-select-statement-with-to-combine-results/#findComment-1360053 Share on other sites More sharing options...
stevew Posted July 8, 2012 Author Share Posted July 8, 2012 Awesome...thanks for the help. Link to comment https://forums.phpfreaks.com/topic/265382-select-statement-with-to-combine-results/#findComment-1360057 Share on other sites More sharing options...
Pikachu2000 Posted July 8, 2012 Share Posted July 8, 2012 this should help you $result = mysql_query("SELECT * FROM tbl WHERE banana LIKE ='yes%' AND banana LIKE = 'yes%' "); That has the same comparison twice. Why? Link to comment https://forums.phpfreaks.com/topic/265382-select-statement-with-to-combine-results/#findComment-1360059 Share on other sites More sharing options...
hakimserwa Posted July 8, 2012 Share Posted July 8, 2012 this should help you $result = mysql_query("SELECT * FROM tbl WHERE banana LIKE ='yes%' AND banana LIKE = 'yes%' "); That has the same comparison twice. Why? I think thats what he wants, he wan t to into the table an d look for apples and bananas that have a value of yes. Link to comment https://forums.phpfreaks.com/topic/265382-select-statement-with-to-combine-results/#findComment-1360060 Share on other sites More sharing options...
stevew Posted July 8, 2012 Author Share Posted July 8, 2012 I will try all of the examples thanks. Link to comment https://forums.phpfreaks.com/topic/265382-select-statement-with-to-combine-results/#findComment-1360061 Share on other sites More sharing options...
Pikachu2000 Posted July 8, 2012 Share Posted July 8, 2012 this should help you $result = mysql_query("SELECT * FROM tbl WHERE banana LIKE ='yes%' AND banana LIKE = 'yes%' "); That has the same comparison twice. Why? I think thats what he wants, he wan t to into the table an d look for apples and bananas that have a value of yes. You should probably read your query string again. It has the same comparison twice, and the syntax is wrong. LIKE doesn't use an equality comparison '='. Link to comment https://forums.phpfreaks.com/topic/265382-select-statement-with-to-combine-results/#findComment-1360064 Share on other sites More sharing options...
hakimserwa Posted July 8, 2012 Share Posted July 8, 2012 this should help you $result = mysql_query("SELECT * FROM tbl WHERE banana LIKE ='yes%' AND banana LIKE = 'yes%' "); That has the same comparison twice. Why? I think thats what he wants, he wan t to into the table an d look for apples and bananas that have a value of yes. You should probably read your query string again. It has the same comparison twice, and the syntax is wrong. LIKE doesn't use an equality comparison '='. hahahah pikachu sorry men ment $result = mysql_query("SELECT * FROM tbl WHERE apple LIKE ='yes%' AND banana LIKE = 'yes%' "); Link to comment https://forums.phpfreaks.com/topic/265382-select-statement-with-to-combine-results/#findComment-1360067 Share on other sites More sharing options...
jcbones Posted July 8, 2012 Share Posted July 8, 2012 Or, you could just go back up to mine, because that is still wrong. //wrong banana LIKE = 'yes%'; //right banana LIKE 'yes%'; Link to comment https://forums.phpfreaks.com/topic/265382-select-statement-with-to-combine-results/#findComment-1360111 Share on other sites More sharing options...
Recommended Posts