I have this small bit of code to fetch the latest songs submitted by a user
on theire profile for my tab website, here is the code:

<?php
$get_songs = mysql_query("SELECT `id`,`title`,`artist_id`,`type` FROM
`resources` WHERE `user_id` = '$id' ORDER BY `rating` LIMIT 0,10");
?>
<table border="0" cellpadding="1"><tr><td><B>10 Latest Songs Submited by
<?php echo($profile_array[0]); ?></b></td><td></td><td></td></tr>
<?php
for ($i = 0; $i < mysql_num_rows($get_songs); $i ++) {
$latsongs = mysql_fetch_row($get_songs);
$get_anames = mysql_query("SELECT `name` FROM `artists` WHERE `artist_id` =
'$id'");
$anames = mysql_fetch_row($get_names);        // !!! ERROR LINE !!!
echo("<tr><td><a
href=\"view.php?id=$latsongs[0]\">$latsongs[1]</a></td><td><a
href=\"artist.php?id=$latsongs[2]\">$anames[0]</a></td><td>($latsongs[3])</t
d></tr>");
}
?>

The problem is with the line i labelled !!! ERROR LINE !!!, to fetch the
artist name.
The error returned is:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result
resource in /home/tabzilla/public_html/profile.php on line 115

You can see the complete page at http://www.tabzilla.com/profile.php?id=3


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to