Hi, I'm new to php/mysql and can't quite figure out why the following script isn't working. It echoes properly but doesn't change the users acces_type_id in the database. The basic plan is when someone registers on the site, I stamp the time() that they registered and store it in the table registered_mem along with all their other user info. Then from that point of registration they have all access to our registered members section of the site. This is allowed with an access_type_id of 14. Then after one weeks time (actually in the below code i have it set for 3 minutes for testing purposes), when they try to access things again, they are changed from a 14 to a 1 for their access_type_id.
The echoe works as I said, but when I check the db the access_type_id is still 14. I have no idea whats going wrong.
Thanks in advance.
<?
include_once('/usr/home/fss/websites/fivestarsports.net/inc/func.inc.php');
$username = $HTTP_COOKIE_VARS['log']['username'];
$db_conn = five_connect_db();
mysql_select_db('fivestar',$db_conn);
$sql = "SELECT * FROM `registered_mem` WHERE `username`='$username'";
$result = mysql_query($sql, $db_conn) or die(mysql_error());
$row = mysql_fetch_assoc($result);
if($row['access_type_id'] == 14){
if(($row['date_added']+=(60*3)) <= time()){
mysql_query("UPDATE `registered_mem` SET(`access_type_id`='1') WHERE `username`='$username'",$db_conn);
echo "Your access is now 1";
}
}?>