Hello everyone,
I'm trying to do a little search engine for my website.
Like often, I've the problem to operate on multiple tables.
This is the part of code that interests my problem. It works but I need to search in more tables than one:
I've tried with this method that was working in another situation but not now. Maybe because it is in a for cycle?
(SELECT *
FROM $table1)
UNION ALL
(SELECT *
FROM $table2)
UNION ALL
etc.
How can I do? :'(
I'm trying to do a little search engine for my website.
Like often, I've the problem to operate on multiple tables.
This is the part of code that interests my problem. It works but I need to search in more tables than one:
Code:
for ($x = 0; $x < count($keys); $x++) {
$querystr = "SELECT img,link,numclick,description,ordine FROM $table1 WHERE description = \"$keys[$x]\" OR description LIKE \"%$keys[$x]%\" OR ordine = \"$keys[$x]\" OR ordine LIKE \"%$keys[$x]%\"";
$result = mysql_query($querystr);
(...)
(SELECT *
FROM $table1)
UNION ALL
(SELECT *
FROM $table2)
UNION ALL
etc.
How can I do? :'(
Comment