wwfc_barmy_army Posted November 5, 2006 Share Posted November 5, 2006 Hello. I have this in my php code:[code=php:0] <?phpif ($artist == ""){print "Please select an artist:<br/>"; $result = @mysql_query("SELECT * FROM artist"); $row = mysql_fetch_array($result);print "<a href=index.php?artist=$row[artist_id]>$row[name]</a>";}?>[/code]I want to return all the rows in the table artist but it's only returning the first one. How can i make it return all?Thanks Link to comment https://forums.phpfreaks.com/topic/26261-mysql-query/ Share on other sites More sharing options...
A3aan Posted November 5, 2006 Share Posted November 5, 2006 You have to loop the query result.[code]while ($row = mysql_fetch_assoc($result)) {echo "<a href=index.php?artist=".$row[artist_id].">".$row[name]."</a>";}[/code] Link to comment https://forums.phpfreaks.com/topic/26261-mysql-query/#findComment-120112 Share on other sites More sharing options...
wwfc_barmy_army Posted November 5, 2006 Author Share Posted November 5, 2006 ahhh, i see. ::)Thanks! :) Link to comment https://forums.phpfreaks.com/topic/26261-mysql-query/#findComment-120114 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.