PHP and MySQL duplicate column name help?

  • Thread starter Thread starter cjconnor24
  • Start date Start date
C

cjconnor24

Guest
Hi all,

I have a quick questiong regarding MySQL querys to multiple tables.

Take the following query for example:

SELECT * FROM guest, category, guestcategory WHERE id='$id'

Now in those three tables there are columns with the same name. When fetching the array

$rows = mysql_fetch_array($sql)
echo $rows['name'];

Is there away to fetch the duplicate column names without calling each in the original query like:

SELECT guest.name AS gname, category.name as cname....etc etc

Hope this makes sense and i look forward to your answers :)

Cheers
 
Back
Top