Jump to content


This topic is now archived and is closed to further replies.


help out a little here..

Recommended Posts

so i'm trying to count the rows in a table ..

the situation is as fallow.. someone leaves a comment about something.. the id goes in to the comment table.. now i want to count how many times ppl left comment about that one thing.. this is what i tried but it dont work..
$rows=mysql_query("SELECT comment_id FROM pcomment WHERE photo_id='pic_id' ");

echo $countrow;

Share this post

Link to post
Share on other sites
this should do:
SELECT count(comment_id) FROM pcomment WHERE photo_id='pic_id'

Full explanation at [a href=\"http://dev.mysql.com/doc/refman/5.0/en/counting-rows.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/5.0/en/counting-rows.html[/a]


Share this post

Link to post
Share on other sites


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.