Page 1 of 1

join table??

Posted: Sun May 18, 2008 7:23 am
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..

Re: join table??

Posted: Mon May 19, 2008 3:26 am
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

Re: join table??

Posted: Mon May 19, 2008 1:35 pm
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