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
https://forums.phpfreaks.com/topic/189332-search-forms/
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
https://forums.phpfreaks.com/topic/189332-search-forms/#findComment-999457
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.