Jump to content

[SOLVED] Hits?


tomtom

Recommended Posts

Hey. I've done it a million times before but it just doesn't seem to work this time.

 

I've made a VERY simple script to update the amount of hits a page has had in mysql. I've set the attribute `hits` to INT.

 

Here's my code. The weird thing is...it'll update the page the first time, from 0 to 1. But then it won't go any higher than 1.

 

<?php
$get_home = mysql_query("SELECT * from `pages`");
while($home = mysql_fetch_array($get_home)) {
    $hits = $home[hits]+1;
    $update = mysql_query("UPDATE `pages` SET `hits` = '" . $hits . "' WHERE `id` = '$home[id]'");
}
?>

Link to comment
https://forums.phpfreaks.com/topic/109118-solved-hits/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.