/    Sign up×
Community /Pin to ProfileBookmark

Counting Comments in blog

Ok on my site [url]http://complexfellow.com[/url] I offer the ability to comment on blog entries. All the entries are stored in a comments table and with each comment a replyto field is filled in so it knows what entry it correpsonds with. How would I count how many comments there are for each entry.

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@ConorauthorMay 11.2004 — Anyone?
Copy linkTweet thisAlerts:
@JonaMay 11.2004 — [font=arial]The MySQL documentation is a powerful resource, you should use it -- it has a search option.

[url=http://dev.mysql.com/doc/mysql/en/mysql_field_count.html]MySQL Field count[/url] and [url=http://dev.mysql.com/doc/mysql/en/mysql_list_fields.html]MySQL list fields[/url] should be useful.[/font]
Copy linkTweet thisAlerts:
@ConorauthorMay 11.2004 — i always feel like an idiot when you post. I tried mysql.net ?
Copy linkTweet thisAlerts:
@JonaMay 12.2004 — [font=arial]lol. When it doesn't exist, always try the next thing. Don't worry, it happens to me all the time (how else would I have a solution?).[/font]
Copy linkTweet thisAlerts:
@ConorauthorMay 12.2004 — well i ended up just using

$x=0 before the while loop and then $x++ right inside of it.
×

Success!

Help @Conor spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...