HokieTracks Posted May 20, 2009 Share Posted May 20, 2009 Hi, I have a code that gets comments posted by users that have been stored in a database: <?php mysql_connect("localhost", "**********", "**********") or die(mysql_error()); mysql_select_db("**********") or die(mysql_error()); $query = "SELECT * FROM graphics WHERE graphicid = '" . mysql_real_escape_string($graphicid) . "'"; $graphics = mysql_query($query) or die(mysql_error()); $row_graphics = mysql_fetch_assoc($graphics); echo $row_graphics['user']; ?> <br> <?php echo $row_graphics['comment']; ?> When the user posts a comment it finds out what the id of the image they are commenting on is (graphicid). So then the code finds where graphicid equals the graphicid that the user is currently viewing and from that gets the comment associated with that graphicid and the user who posted the comment. The problem is that it only displays the latest entry. So if the are 10 entries with a graphicid of 2 it only displays the one most recently added. Quote Link to comment https://forums.phpfreaks.com/topic/158996-solved-displaying-multiple-entries-that-have-similar-value/ Share on other sites More sharing options...
HokieTracks Posted May 21, 2009 Author Share Posted May 21, 2009 Found the answer from another site. If anyone is interested it's here. http://forums.devshed.com/mysql-help-4/displaying-multiple-entries-that-have-similar-value-612497.html#post2264800 Quote Link to comment https://forums.phpfreaks.com/topic/158996-solved-displaying-multiple-entries-that-have-similar-value/#findComment-838596 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.