Hello,
Im a little bit confused with this piece of coding I have!
Im basically trying to add a script I have converted to a web page! The original code was using echo statements which was fine on a separate page but now I want it to be apart of my profile pages.
Here is the code:
$getComment = fetch("SELECT * FROM members_comments WHERE post_to ='$user' AND game='$game'");
//Retrieves data from MySQL
$data = mysql_query("SELECT * FROM members_comments WHERE post_to = '$members_profiles[username]' ") or die(mysql_error());
//Puts it into an array
while($info = mysql_fetch_array( $data ))
{
//Outputs the image and other data
$comments ="
<br>Comment</b> ".$info['post_message']."<br>
<br>By:</b> ".$info['post_by']."<br>
<b>Sent On:</b> ".$info['timestamp']."<p>
<hr color=\"#008000\" width=\"300\">
" ;
}
Now by using the current code it DOES show the contents from the mysql but only shows ONE result! I would like it to show all results from the mysql.
My guess is I have mucked up the WHILE bit which is the bit thats meant to repeat it isnt it?
This is the original code when not integrated into my web page and it collects all field results from the mysql table and not jut the one.
//Retrieves data from MySQL
$data = mysql_query("SELECT * FROM members_comments WHERE post_to = '$members_profiles[username]' ") or die(mysql_error());
//Puts it into an array
while($info = mysql_fetch_array( $data ))
{
//Outputs the image and other data
echo "<br>Comment</b> ".$info['post_message']."<br>";
echo "<br>By:</b> ".$info['post_by']."<br>";
echo "<b>Sent On:</b> ".$info['timestamp']."<p>
<hr color=\"#008000\" width=\"300\">" ;
Id apreciate any help!
Thank you
Justin