Jump to content


Photo

help out a little here..


  • Please log in to reply
1 reply to this topic

#1 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 28 May 2006 - 10:03 PM

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' ");
$countrow=mysql_num_rows($rows);

echo $countrow;


#2 appeland

appeland
  • Members
  • PipPipPip
  • Advanced Member
  • 30 posts

Posted 28 May 2006 - 10:22 PM

Hi,
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]

Regards,
Andi





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users