Jump to content

[SOLVED] Displaying Multiple Entries That Have Similar Value


HokieTracks

Recommended Posts

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.