garry Posted May 19, 2008 Share Posted May 19, 2008 So I'm having a little trouble with my SQL queries and distinguishing between the different ID's that I want to get. Here's an example of a query (just made up to show you what i mean): $query=" SELECT artists.id, reviews.id FROM artists, reviews WHERE blah blah blah "; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { echo $row['id']; } So how can I make it so I can distinguish from which table I want to get the ID from? Thanks! Link to comment https://forums.phpfreaks.com/topic/106269-solved-troubles-with-sql-queries/ Share on other sites More sharing options...
Barand Posted May 19, 2008 Share Posted May 19, 2008 use aliases SELECT artists.id as artistid, reviews.id as reviewsid Link to comment https://forums.phpfreaks.com/topic/106269-solved-troubles-with-sql-queries/#findComment-544647 Share on other sites More sharing options...
garry Posted May 19, 2008 Author Share Posted May 19, 2008 Works like a charm, thanks buddy Link to comment https://forums.phpfreaks.com/topic/106269-solved-troubles-with-sql-queries/#findComment-544652 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.