问题
How can I create a global search in my site? The site is internal and not available on the net and I can't use Google Search for this.
I have information that is stored all in different MySQL tables. For example account are stored in the account table, account related addresses are stored in the addresses table, phone number in the phone number table, contact are stored in the contact table........etc.
I want to create a search bar it allow the user to type any value and the system will find it. So if you search for a phone number then the system will find the record. if you search for account name then the system will also find it.
How can I build this without having to ask the user to select where do they want to search?
What is the way to build such a global search. Note the the system is written in PHP and the data is stored in MySQL database. and there are lots of records in the system.
Thanks
回答1:
I made a php class that you can download it here and using that is quite easy... make an object for every search and use the result... either you can improve it yourself...
It will search all of your tables
, and you can give the target column name
or not...
read readMe.md
file...
Hope this helps you...
来源:https://stackoverflow.com/questions/22798834/how-to-create-a-global-search-in-my-site