Jump to content

newbie learning :D - comments not working


PaXo

Recommended Posts

<?php

 

mysql_select_db('comments');

$query = "SELECT comments.comment_image, album.image_id FROM album, comments WHERE comment_image = image_id ORDER BY comment_id";

$result = mysql_query($query);

 

 

while($row=mysql_fetch_array($result))

{

$comment_id = $row['comment_id'];

$comment_user = $row['comment_user'];

$comment_email = $row['comment_email'];

$comment_ip = $row['comment_ip'];

$comment_content = $row['comment_content'];

$comment_time = $row['comment_time'];

$comment_date = $row['comment_date'];

}

 

echo $comment_user;

echo $comment_content;

 

?>

 

that is the code but it dosnt display the echos, there is information in the database but i dont  have a clue why it wont display

 

any help is much loved <3

Link to comment
Share on other sites

unfortunatly that didnt work,

 

heres the updated code:

 

<?php

 

mysql_select_db('comments');

$query = "SELECT comments.comment_image, album.image_id FROM album, comments WHERE comment_image = image_id ORDER BY comment_id";

$result = mysql_query($query);

 

 

while($row=mysql_fetch_array($result))

{

$comment_id = $row['comment_id'];

$comment_user = $row['comment_user'];

$comment_email = $row['comment_email'];

$comment_ip = $row['comment_ip'];

$comment_content = $row['comment_content'];

$comment_time = $row['comment_time'];

$comment_date = $row['comment_date'];

 

echo $comment_user;

echo $comment_content;

 

}

 

?>

 

thanks for the quick reply though!

Link to comment
Share on other sites

this is the page output:

 

SELECT comments.comment_image, album.image_id FROM album, comments WHERE comment_image = image_id ORDER BY comment_id

Resource id #5

 

this is the updated code:

 

<?php

 

mysql_select_db('comments');

$query = "SELECT comments.comment_image, album.image_id FROM album, comments WHERE comment_image = image_id ORDER BY comment_id";

$result = mysql_query($query) or die (mysql_error());

 

echo $query;

echo '<br>';

echo $result;

 

 

while($row=mysql_fetch_array($result))

{

$comment_id = $row['comment_id'];

$comment_user = $row['comment_user'];

$comment_email = $row['comment_email'];

$comment_ip = $row['comment_ip'];

$comment_content = $row['comment_content'];

$comment_time = $row['comment_time'];

$comment_date = $row['comment_date'];

 

echo $comment_user;

echo $comment_content;

 

}

 

?>

 

so it dosnt say anything is wrong with the query :/ (thatim aware of, code nos what resource id 5 is but ... thanks :)

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.