Jump to content

Search Forms


cs1h

Recommended Posts

Hi ,

 

I having been trying to create a keyword search form using php and mysql but have had little luck doing what I need to do.

 

I want the user to be able to put multiple words into a single search box and then search three columns in a table to find possible matches.

 

Can anyone help me with this or point me towards a good tutorial?

 

Thanks,

Cs1h

Link to comment
Share on other sites

It really just comes down to building the query.

 

If you mean that they will enter one set of keywords that will  be searched against all three columns separately, it could be as easy as

 

$kw = $_POST['keywords'];
$query = "SELECT * FROM table WHERE column1 LIKE '$kw%' OR column2 LIKE '$kw%' OR column3 LIKE '$kw%'";

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.