Jump to content

Update profile views


JackCode

Recommended Posts

Hi, basically I want a dynamic hit counter every time someone views someone else's profile. Here is my code:

 

<?php
 
$req = mysql_query('select hits from users where username="'.$username.'"');
$dn = mysql_fetch_array($req);
 
$update = mysql_query('UPDATE users SET hits = hits + 1 WHERE username="'.$username.'"');
 
 
echo "Profile views: ".$dn['hits'];
 
 
?>
 
It returns the value in the database but does not update it dynamically unless I change it myself in the database. 
Link to comment
https://forums.phpfreaks.com/topic/286113-update-profile-views/
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.