SELECT *
FROM tableA a
INNER JOIN tableB b
ON a.someColumn = b.otherColumn
INNER JOIN tableC c
ON b.anotherColumn = c.nextColumn
What if tableA and tableB has the same name in fields? How can I use:
<?
$name = mysql_fetch...
echo $name['a.title'] . ' ' . $name['b.title'];
?>
So I could get title from tableA and title from tableB. Because now, if use just $name['title'] it returns tableA’s title. And the above code unfortunately gives just an empty string.
Instead of doing
select *, you can put an alias on the columns as well.Then your PHP would be something like: