textbox Posted May 18, 2007 Share Posted May 18, 2007 Hello. I wish to pull out a row of the top 3 friends. The top friends bit i think i can sort, however, which is the best way to retrieve the image and username and link the username into the picture? $getimages = mysql_query("SELECT `username`, `thumblocation` FROM `images` WHERE `timeposted` ORDER BY `timeposted` ASC LIMIT 3"); while ($image=mysql_fetch_array ($getimages) ) { echo "<a href='/__site/$username'><img src=\"$image[thumblocation]\"></a>";echo $spacer; } I have this, but it doesnt appear to help me much! Thanks in advance Link to comment https://forums.phpfreaks.com/topic/51936-pulling-out-top-friends/ Share on other sites More sharing options...
phast1 Posted May 18, 2007 Share Posted May 18, 2007 Try it like this: $getimages = mysql_query("SELECT username, thumblocation FROM images ORDER BY timeposted ASC LIMIT 3"); while ($image=mysql_fetch_assoc($getimages)) { echo "<a href='/__site/$username'><img src=\"$image['thumblocation']\"></a>"; echo $spacer; } Link to comment https://forums.phpfreaks.com/topic/51936-pulling-out-top-friends/#findComment-256048 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.