Jump to content

Search - Textfield


yandoo

Recommended Posts

Hi there,

 

I need to build a search form that has a simple text field that the user can use to search a table in my database. The drop down options would be used to determine what field in the table you are searching....

 

Could somebody point me in the direction of a good tutorial or where i can find out how to build this please??

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/99517-search-textfield/
Share on other sites

Use InnoDB (i think) table format and then add a fulltext index to the fields you want to be able to search. You'll need to find a bit more information on this as its been a while since i did this but something like

SELECT *,search FROM `table` WHERE MATCH('text_field_input') AGAINST(`field`) AS `search` ORDER BY `search` DESC;

 

This (should, again, been a while, you might have to play with the syntax) will take your input, match it against a field and display the results from the highest matched percentage to the lowest (out of 1, * by 100 if you want actual percentage to display).

Link to comment
https://forums.phpfreaks.com/topic/99517-search-textfield/#findComment-509119
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.