Search page engine PHP with MYSQL database? -
i'm going generalize question other people can use answers.
let's have website driven mysql database.
database contains 5 tables:events,news,books,articles,tips.
every table has among others 2 fields title , details in want search
on every page of site have search form (text field , button).
after type word or phrase want redirected page called search should see results list links entire database.
e.g.
book x (link on book found in database)
event y
article z
help: tables innodb engine full text search didn't work i'm having trouble in building select statement searching multiple fields multiple tables like. i've succeded 1 table multiple tables , multiple fields i'm getting error or no data or duplicated data in cases. select statement please.
question: how build search engine tables in mysql db? sql injection or other hacking prevention advice appreciated also.
my approach situation create view based on tables similar columns ( columns need search only) , 1 more alias column table names/ entity name (books, event etc)
it should this
entityname title details books xxxx xxxxx ...............................
i not explaining how create views union (dont use union if not expecting duplicates).
the next stop search using statements
select * vwsearchdata title '%keyword' or details '%keyword'
next step display data along entity names.
ofcourse, need keyword filtering html entities search form.
Comments
Post a Comment