Querying mysql with PHP

They have: 71 posts

Joined: Aug 2001

I am writing a search script and it needs to search the following tables in one query (or so that it produces results on the same page without messing up); articles, hints, products.

How would I go about doing this? I have worked with simple searches before but nothing quite this complex.

Somebody help me please,

Thanks,

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I don't know your table structure, so I'm just making a general query.. something like this:

SELECT table1.field1 as field1, table2.field2 as field2, table3.field3 as field3
FROM table1 JOIN table2 JOIN table3
WHERE INSTR(table1.field1, 'find me') OR INSTR(table2.field2, 'find me') OR INSTR(table3.field3, 'find me')

Mark Hensler
If there is no answer on Google, then there is no question.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.