Welcome to WebmasterWorld Guest from 220.127.116.11
Right now, if people want to search for "berry", they would have to go to my A database to search for it. Then if they want to search for "berry" from my B database, they would have to go there to search. So it's very inconvenient. I know I could just incorporate all the databases together into one big database, but I don't want to do that.
I hope I haven't lost anyone yet. Does anyone have any idea of doing that? Thanks.
if you have multiple databases in the same "database" (e.g. mySQL), then you can use
// do query
// do another query
If you have multiple tables in the same database, then as mentioned above you can try a JOIN or UNION or something. I am hardly capable of giving advice on that subject... Hopefully someone will jump in with a solution, if there is one.
Regardless of the method you use to grab the hits, you will want to "mix" and sort the results by relevance. If there is a way to do it with just SQL, then do that! But it's easier to do in PHP, once you've grabbed all the close hits and thrown them into an array.
$hits['title]="this is my page"
$hits['title]="this is your page"
then you can sort the array by relevance, and show them in order.
If searching is really key to the functionality to your site, you could also set up another table that just has all the information from your other tables that you want searchable in one field, and an identifier or url in another field corresponding to the page all that info is on. This could use a fulltext index for better search relevance. It'll use a lot of hard disk space, but hard disk space is cheap these days.