Jump to content

[SOLVED] Only geting exact match from database query


seriousdamage

Recommended Posts

Hi,

when I run the following query I only get the exact match of what I have searched for,

I think I need to use % sign so that I can search for Nic and get also Nicola as a result.

But I can figuer out where to add the %

 

I use an external webform for the search.

 

$result = mysql_query("SELECT * FROM contacts where first_name LIKE '" . $_POST['search'] ."' OR last_name LIKE '" . $_POST['search'] ."' OR company_name LIKE '" . $_POST['search'] ."' OR website LIKE '" . $_POST['search'] ."' OR street LIKE '" . $_POST['search'] ."' OR city LIKE '" . $_POST['search'] ."' OR zip LIKE '" . $_POST['search'] ."' OR country LIKE '" . $_POST['search'] ."' OR mail1 LIKE '" . $_POST['search'] ."' OR mail2 LIKE '" . $_POST['search'] ."' OR phone LIKE '" . $_POST['search'] ."' OR mobile LIKE '" . $_POST['search'] ."' OR card LIKE '" . $_POST['search'] ."' OR birthday LIKE '" . $_POST['search'] ."'") or die (mysql_errno().": ".mysql_error()."<BR>");

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.