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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.