search keywords in all pages in my website

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
tkdbb84
New php-forum User
New php-forum User
Posts: 137
Joined: Tue Mar 08, 2011 9:25 am

Re: search keywords in all pages in my website

Post by tkdbb84 » Fri Oct 26, 2012 7:21 am

As far as I've ever seen you cannot search across multiple tables at once. (at least without using a join and there by losing the table the result came from). The only way to handle this would be to execute multiple queries, one on each table and search for the term across whatever fields you wish to search.

Select 1 from <table_1> WHERE <field_1> LIKE %<term>% AND <field_2> LIKE %<term>% ........
Select 1 from <table_2> WHERE <field_1> LIKE %<term>% AND <field_2> LIKE %<term>% ........

or if you are using a fulltext index you can use match against on multiple fields as well.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests