join table??

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
kanchan
Forum Commoner
Posts: 80
Joined: Tue Nov 30, 2004 12:03 pm

join table??

Post by kanchan »

hi!!

is there any method to join 2 mysql tables..
i m thinking to make a gallery page and i think for the gallery i need to tables and it may need to join both tables....
is there any way to make simple gallery script with mysql backend?

Help me guys..... i am a simple php coder(not a professional)....
please......
i will be very grateful to you...

thanks in advance..
User avatar
allspiritseve
DevNet Resident
Posts: 1174
Joined: Thu Mar 06, 2008 8:23 am
Location: Ann Arbor, MI (USA)

Re: join table??

Post by allspiritseve »

kanchan wrote:hi!!

is there any method to join 2 mysql tables..
i m thinking to make a gallery page and i think for the gallery i need to tables and it may need to join both tables....
is there any way to make simple gallery script with mysql backend?

Help me guys..... i am a simple php coder(not a professional)....
please......
i will be very grateful to you...

thanks in advance..
This is more of a mysql question than a php apps question...

You can do a join like this:

Code: Select all

SELECT * FROM table1 INNER JOIN table2 ON (table1.field = table2.field)
I suggest you look at the mysql docs for your mysql version, they have tons of information on the different types of joins. http://dev.mysql.com/doc/

Good luck,

Cory
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: join table??

Post by califdon »

kanchan wrote:is there any method to join 2 mysql tables..
i m thinking to make a gallery page and i think for the gallery i need to tables and it may need to join both tables....
is there any way to make simple gallery script with mysql backend?

Help me guys..... i am a simple php coder(not a professional)....
All of relational database design is based on joining tables, but the real issue is understanding how to design tables and why you need to join them. It is not a matter of "I think I need 2 tables", it is the result of careful relational database design. I strongly suggest that you read some tutorials on relational databases, such as:
http://www.campus.ncl.ac.uk/databases/d ... esign.html
http://www.kirupa.com/developer/php/rel ... design.htm
http://www.tekstenuitleg.net/en/article ... tutorial/3
Post Reply