searching multiple tables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
elecktricity
Forum Contributor
Posts: 128
Joined: Sun Sep 25, 2005 8:57 pm
Location: Trapped in my own little world.
Contact:

searching multiple tables

Post by elecktricity »

is it possible to search multiple tables when using php to search the database? any links or code would be greatly appreciated
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Code: Select all

$someID = 1;

SELECT table1.*,table2.* from table1 
where
table1.id = $someID and table2.id = $someID
Also, you may want to search here for JOINS.
Last edited by hawleyjr on Mon Dec 05, 2005 5:05 pm, edited 1 time in total.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

What database system (DBMS) are you using? MySQL, PostgreSQL, Microsoft SQL? It's possible to "join" your tables in a single query yes. Could you give some more info? :)
User avatar
elecktricity
Forum Contributor
Posts: 128
Joined: Sun Sep 25, 2005 8:57 pm
Location: Trapped in my own little world.
Contact:

Post by elecktricity »

using mysql, ill go lookup the 'JOINS' thing
Post Reply