SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Times Viewed

  1. #1
    SitePoint Member rIGO's Avatar
    Join Date
    Jan 2002
    Location
    Malta
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Times Viewed

    i read kevin's book (1st edition)... and i liked the idea that by adding a column in my MySQL table i can know how many ppl read the articles on the site. so i copied the code below:
    PHP Code:
    $viewed = @mysql_query("UPDATE news SET viewed=viewed+1 WHERE id=$id;"); 
    this just the job very well, but has one problem. i also have a 'posted' column which timestamps the time the article was written... but every time a user views the article...the posted column is updated. what can i do...so it doesnt get updated?

    rIGO
    rIGO

  2. #2
    SitePoint Guru okrogius's Avatar
    Join Date
    Mar 2002
    Location
    US
    Posts
    622
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Timestamp columns are for when the row was last updated. Not for other purposes.

    You need to use a proper column type for your posting date.


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
  •