Web Analytics Made Easy -
StatCounter Showing # of comments - CodingForum

Announcement

Collapse
No announcement yet.

Showing # of comments

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Showing # of comments

    I am making a comments system for my blog and I want to show how many entries total there are in the comments db table. How might I do this? I was thinking about SELECT MAX(id) FROM comments, but if you deleted one, it would show the highest number, not the total number of comments.

    Thanks to all,

    Stevie
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #2
    mysql_num_rows() will show the number of comments

    Comment


    • #3
      If you don't want to display the comments, then you can use

      select count(*) as thecount from ....
      and then you can use $row['thecount'] to get the count.

      If you also display the comments, then use mysql_num_rows() like Nightfire suggested.
      Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

      Comment


      • #4
        Originally posted by Nightfire
        mysql_num_rows() will show the number of comments
        I knew that. I'm stupid. Thanks, it works.
        Stevie Peele
        Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
        #dev - any programming,etc. question
        #design - design discussion and critque
        #central - general chat
        Come join us!

        Comment


        • #5
          Another day, another noob saved :-D. jk

          Comment


          • #6
            Noob? No.

            Expert? No.

            So, go on.
            Stevie Peele
            Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
            #dev - any programming,etc. question
            #design - design discussion and critque
            #central - general chat
            Come join us!

            Comment

            Working...
            X