SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Dec 1999
    Location
    Highlands Ranch, CO
    Posts
    193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can you count calls to a record in MySql?

    I have a database of articles. I am not an expert on this stuff, but I want to know: (in PHP/MySQL)

    1. Each time an article is called from MySQL database it increments a counter in that DB row.

    Is there a built in function or something? All I can think of is to somehow "UPDATE articles" to add '1' to the COUNT field each time the article is displayed.

    All I need is a counter (of views) for each row in the Articles database.

    Does this make sense?

    Bigtime TIA
    Last edited by Chad J; Oct 29, 2002 at 10:41.

  2. #2
    SitePoint Zealot
    Join Date
    Dec 1999
    Location
    Highlands Ranch, CO
    Posts
    193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nevermind - I got it. My brain just froze up.

    Made a count field on the articles db - default 0.

    Then make this SQL statement
    mysql_query("UPDATE article SET count = count+1 WHERE rid=xxx");

    Thanks though!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •