Joe Bills Joe Bills - 2 years ago 108
SQL Question

Profile View Update

I am trying to create a query which will update each person's profile views when a member accesses their profile. For some reason it does not update, I am sure it would have worked. Here is my lines:

$name = $_REQUEST['username'];
$profile = mysql_query("SELECT * FROM users WHERE user_name='$name'");
$uprofile = mysql_fetch_assoc($profile);

$username = $uprofile['user_name'];
$profilev = $uprofile['profile_views'];

mysql_query("UPDATE users SET profile_views +1 WHERE user_name='$name'");


So, On my profile, It displays their username successfully, and it displays the default value of the database for profile_views which ofcourse, is
. so it is reading correctly, I am just having issues updating the users profile_views.

Answer Source

You have a mistake try

"UPDATE users 
 SET profile_views = profile_views  +1 
 WHERE user_name='$name'"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download