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

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']."'");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.