PHP - DYNAMIC PAGE counter

I have a dynamic page that retrieves data from a database. Say, for example, there are 2 records that are generated depending on the request. So what I want to do, when someone clicks the "Home" link on the first record, it should go to the next page, and there is a php code that will increase the counter, how many times the page will be displayed

Similarly, when the second Home link entry is clicked, it should go to some page, and then repeat the counter again so that this page grows

so say for example

Homepage - 1st Entry - Page: http://www.abc.com/Wakad-T4248349

Homepage - Second Entry - Page: http://www.abc.com/Himn-T3333333

Or another way to do this, please help

<div id="menubar">
  <ul>
    <li class="current_page_item">
      <a href="count.php" name="abc<?php $i; ?>">Home</a>
      <?php $_SESSION['Home']=$row['ID']; echo $_SESSION['Home'];?>
    </li>
  </ul>
</div>


<div id="menubar">
  <ul>
    <li class="current_page_item">
      <a href="count.php" name="abc<?php $i; ?>">Home</a>
      <?php $_SESSION['Home']=$row['ID']; echo $_SESSION['Home'];?>
    </li>
  </ul>
</div>
+3
source share
2 answers

Why not just have a field in the database that keeps track of how many times this page has been selected? Or are you looking for unique IP addresses?

0
source

Assuming you are not in control of abc.com, you will need to link to one of your own pages:

<a href="redirect.php?link=abc.com/Wakad-T4248349"> ...

and on redirect.php, increase your counter (which you probably want to save in the database ...) and redirect them to the page.

0
source

All Articles