select from two tables

From: Date: Sat, 27 Jul 2002 13:05:45 +0000
Subject: select from two tables
Groups: php.db 
Request: Send a blank email to php-db+get-20834@lists.php.net to get a copy of this message
I have the following code: $query = "SELECT * FROM xoops_album,xoops_artist WHERE xoops_album.artist_id = xoops_artist.artist_id"; $albumby = mysql_query($query) or die("Select Failed!"); echo"<td><center>"; if (mysql_num_rows($albumr)) { while ($album = mysql_fetch_array($albumr)) { echo ($album[album]); echo"<i> by "; echo ($albumby[xoops_artist.artist]); echo"<i><br>"; } echo "</center></td>"; } What I'm trying to do is select the album title from one table ( this works ok ) and get the artist name from another table ( this is the part I can't get to work ). I believe it has something to do with the code above as the rest works ok. The result I end up with is below: Waterloo by ( this is where I want to put the artist name) Thanks for in help in advance.

« previous php.db (#20834) next »