Jump to content


Some Sql/php Help


1 reply to this topic

#1 Debian

    Young Padawan

  • Members
  • Pip
  • 14 posts

Posted 05 May 2005 - 06:11 PM

Well I made a news script for this site and then made a comments system...from scratch. It's all done but I'm wondering how I can display how many comments have been made on each post. Here is my MySQL Structure:

CREATE TABLE `comments` (
  `id` varchar(25) NOT NULL default '',
  `content` text NOT NULL,
  `name` text NOT NULL,
  `email` text NOT NULL,
  `time` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

The id field has the post ID that the comment was made in, content is obviously the content and you know the rest.

Any ideas?

#2 Neil

    Past Staff Member

  • Members
  • Pip
  • 149 posts
  • Gender:Male
  • Location:Australia

Posted 07 May 2005 - 06:49 AM

umm

$total = mysql_result(mysql_query("SELECT COUNT(id) FROM comments WHERE id='$postidhere'"),0);

read this http://zulumonkey.or...=comment&oid=10





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users