Jump to content

[SOLVED] what do I have to do to display comments on a different pages ??


yami007

Recommended Posts

well, this is my page where i want to display different comments for each isngle page, it needs a lot so i'm counting on you..

 

<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php	
function get_comments_for_singer($singer_id) {
     	global $connection;
     	$query = "SELECT * FROM comment ";
     	$comment_set = mysql_query($query, $connection);
     	confirm_query($comment_set);
     	return $comment_set;
     }
     
?> 
<?php find_selected_page(); ?>
<?php 
if (isset($_GET['comment'])) {
	$comments = get_comments_for_singer($sel_comment['id']);
	while ($comment = mysql_fetch_array($comments)) {
?>
<html>
<head>
  <title><?php echo "My comments";  ?></title>
  <link rel="stylesheet" href="stylesheets/style.css" type="text/css" />
</head>
<body>
<strong><?php echo $comment['pseudo']; ?></strong> a écrit:<br />
<?php echo $comment['message']; ?>
</body>
</html>
<?php
      }
} else {
echo "the page isnt available";
}
?>
<?php mysql_close(); ?>

 

and here's my comment table

 

CREATE TABLE `comment` (
  `id` int(11) NOT NULL auto_increment,
  `singer_id` int(11) NOT NULL,
  `pseudo` varchar(30) NOT NULL,
  `message` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

 

I tried to use 

"WHERE singer_id =" . $singer_id . " ";

but it didnt work

need your help !

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.