Sunday, July 12, 2009

I do have MYSQLdatabase and using PHP language... What syntax do i will use to search by typing a specific?

word and displays all the search ones.


eg.. in my database... recorded samples ....


edwin


john


john michael


andrew


Lloyd john


Eunice


John C. Goerge





from the search form ... upon typing the word "john"


it will search from the database and displays all related to the word john


eg.


John


John Michael


Lloyd John


John C. Goerge





Please give me the syntax on the search form and on the display form... Thanks

I do have MYSQLdatabase and using PHP language... What syntax do i will use to search by typing a specific?
There are 2 main search queries that you can preform.





1. SELECT * FROM table_name WHERE (name LIKE '%$string%')





2. SELECT * FROM table_name WHERE MATCH(name) AGAINST('*$string*' IN BOOLEAN MODE)





The second one is much faster, but has its limitations.





For more information on this and for ways to improve these basic queries, go to http://www.roscripts.com/PHP_search_engi...


No comments:

Post a Comment