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 Quote 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; } Quote Link to comment https://forums.phpfreaks.com/topic/51936-pulling-out-top-friends/#findComment-256048 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.