phpretard Posted October 25, 2008 Share Posted October 25, 2008 I am searching my Database with the following query: $result = mysql_query("SELECT DISTINCT Email FROM Emails WHERE Email LIKE '%$list%' ORDER by Email "); Is there a way I can add more diverse searches such as: Right now I can serch everything containing the word "realty". What if I wanted to (in the same query) search for ONLY emails containg "realty" and "bank". How can I adjust this to perform such a serch? The form: <form name='sea' action='' method=post> <input type=text name=list size=30 /> <input type=submit name='GetList' value='search'> </form> Is this question clear? Thanks for your help! Link to comment https://forums.phpfreaks.com/topic/130052-email-query-question/ Share on other sites More sharing options...
JavaNinja Posted October 25, 2008 Share Posted October 25, 2008 $result = mysql_query("SELECT DISTINCT Email FROM Emails WHERE Email LIKE '%$list%' ORDER by Email "); How can I adjust this to perform such a serch? Use "AND" like so: <?php $result = mysql_query("SELECT DISTINCT Email FROM Emails WHERE Email LIKE '%$list%' AND Email LIKE '%$list2%' ORDER by Email ");?> Link to comment https://forums.phpfreaks.com/topic/130052-email-query-question/#findComment-674373 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.