Inner Join Results Question

Codes here !

Moderators: macek, egami, gesf

kimster
New php-forum User
New php-forum User
Posts: 1
Joined: Sun Jul 01, 2012 11:27 am

Inner Join Results Question

Postby kimster » Sun Jul 01, 2012 11:32 am

I am just starting to get to grips with inner joins but I cannot see how to reference a given column in the result e.g. normally for unique columns I would just reference each column as $row['colname'] but where there are multiple tables with the same column name e.g. table1.name, table2.name etc. the reference $row['table1.name'] does not work - can anyone help me out? Thanks in advance!

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Inner Join Results Question

Postby johnj » Wed Jul 04, 2012 8:33 am

When you do the select, do it as select table1.name as table1_name, table2.name as table2_name etc.
So, you can access the result as $row['table1_name'] or $row['table2_name'].


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest