stelthius Posted January 20, 2009 Share Posted January 20, 2009 Hello again guys, Ive written this <?php include('include/session.php'); $res = mysql_query("SELECT * FROM `users` ORDER BY `signupdate` LIMIT 5"); while ($row = mysql_fetch_assoc($res)) { echo "New User : " . $row['username'] . ""; echo "<img src=include\avatar\"". $row['avatar']."\><br>"; } ?> To display the 5 newest members on the site, i also want it to show there avatar i have it working in a sense i just have a small issue of actually getting it to show the image instead of giving this /test/include/avatar/noavatar.png Which will display the users Avatar its giving me the following, /test/include/avatar%22noavatar.png/ It's wrong but im not sure why its actually doing it anyone have any suggestions ? i have browsed google for some tips & hints but i have come to no avail. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
shlumph Posted January 20, 2009 Share Posted January 20, 2009 Might need another double quote to end the src attribute of the image: <?php echo "<img src=include\avatar\"". $row['avatar']."\" /><br>"; If not look at the source code and see why the HTML isn't being outputted correctly Quote Link to comment Share on other sites More sharing options...
stelthius Posted January 20, 2009 Author Share Posted January 20, 2009 Ok i have figured out the trailing slash problem the only one i am well and truely stuck on is how to stop it adding %22 when it should just be adding a / its now showing /test/include/avatar%22noavatar.png Intead of /test/include/avatar/noavatar.png Any ideas or tips are greatly appretiated, thanks rick Quote Link to comment Share on other sites More sharing options...
stelthius Posted January 20, 2009 Author Share Posted January 20, 2009 Adding the snippet you gave me just made it add another %22 at the end of the whole url, Quote Link to comment Share on other sites More sharing options...
stelthius Posted January 20, 2009 Author Share Posted January 20, 2009 Changing it to this echo "<img src=include\avatar/". $row['avatar']."><br>"; Solved my issues, thanks guys. Quote Link to comment Share on other sites More sharing options...
killah Posted January 20, 2009 Share Posted January 20, 2009 <?php include('include/session.php'); //add some efficiency $res = mysql_query("SELECT `username`,`avatar` FROM `users` ORDER BY `signupdate` LIMIT 5"); while ($row = mysql_fetch_assoc($res)) { echo 'New User : '.$row['username']; echo '<img src="include/avatar/'.$row['avatar'].'"><br>'; } ?> Quote Link to comment 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.