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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.