Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. how to calculate views?

how to calculate views?

Scheduled Pinned Locked Moved Web Development
comhelptutorialquestionannouncement
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    Hi, I have articles web project. I want to calculate the views of every article, just like the views of post in forums. I created a table article_views with article_id, view_date, view_ip so everytime the page will load it will add a record but that is a problem because anyone can refresh the page to increase the views! what's the proper way to do it please? Thanks, Jassim

    Technology News @ www.JassimRahma.com

    N P 2 Replies Last reply
    0
    • J Jassim Rahma

      Hi, I have articles web project. I want to calculate the views of every article, just like the views of post in forums. I created a table article_views with article_id, view_date, view_ip so everytime the page will load it will add a record but that is a problem because anyone can refresh the page to increase the views! what's the proper way to do it please? Thanks, Jassim

      Technology News @ www.JassimRahma.com

      N Offline
      N Offline
      nainakarri
      wrote on last edited by
      #2

      Hi Try to validate using viewstate. When the page loads, increase the view count by comparing the viewstate object to null. Then take an object in viewstate. Second time when the user refreshes the page, viewstate object exists and skip the count increment. Please give a try and let me know how this worked. Thanks Naina

      Naina

      P 1 Reply Last reply
      0
      • N nainakarri

        Hi Try to validate using viewstate. When the page loads, increase the view count by comparing the viewstate object to null. Then take an object in viewstate. Second time when the user refreshes the page, viewstate object exists and skip the count increment. Please give a try and let me know how this worked. Thanks Naina

        Naina

        P Offline
        P Offline
        pandu web dev
        wrote on last edited by
        #3

        Which programming language? In PHP you can use sessions to prevent data refresh after page load.

        1 Reply Last reply
        0
        • J Jassim Rahma

          Hi, I have articles web project. I want to calculate the views of every article, just like the views of post in forums. I created a table article_views with article_id, view_date, view_ip so everytime the page will load it will add a record but that is a problem because anyone can refresh the page to increase the views! what's the proper way to do it please? Thanks, Jassim

          Technology News @ www.JassimRahma.com

          P Offline
          P Offline
          pandu web dev
          wrote on last edited by
          #4

          Which programming language, you are using? In PHP use sessions to prevent data refresh after page load.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups