Jump to content

%Email% Query Question


phpretard

Recommended Posts

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

 

$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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.