0

Hello.

I've been banging my head against the wall with this problem and am lost as to how to work it.

I have two tables

headlines
comments

The primary key of the headlines table is HID, and this value is placed by hidden field into the form to submit comments.

Headlines are submitted and users can comment on them, their thoughts are posted to the comments table - when the user posts, their username, comment, and the primary key of the headline are posted to the comments table.

The headlines table has a field called ccount in it, what I need is for this table to contain a count of the number of comments relative to that headline. So if headline 29 has three comment the value for ccount of headline 29 should be 3.

I am using Dreamweaver and have an index of the submitted headlines using a repeat region, ever query I've developed so far shows the same value for every record in the region.

I'm probably missing something simple, any help would be appreciated.

I am using mysql 5.0.51a and PHP 5.2.6

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Shanti C
0

try this:

$t=mysql_query("select * from headlines");
$result=mysql_fetch_array($t);
$r=mysql_query("select c as count(*) from comments where hidofctbl='".$result['hid']."'");
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.