Jump to content

[SOLVED] it is set... but not sending right value


blueman378

Recommended Posts

hi guys,

 

well i have a class called session

 

i also have a class called database

 

in session heres a portion:

 

    	$this->userinfo  		= $database->getUserInfoUsername($subuser);
	$this->username  		= $_SESSION['username'] = $this->userinfo['username'];
	$this->userid    		= $_SESSION['userid']   = $this->userinfo['user_id'];
	$this->userlevel 		= $this->userinfo['user_level'];
	$this->usercookiekey 	= $this->generateRandID();
	$database->updateUserField($this->userid, "user_cookiekey", $this->usercookiekey);
	$database->addActiveUser($this->userid, time());

 

now whats happening is the updateUserField function is working perfectly.

however the add ActiveUser function is setting 0 as the user id heres both functions:

 

function addActiveUser($usersid, $userstime)
{
	$ip = $_SERVER['REMOTE_ADDR'];
	$q = "DELETE FROM guests_active WHERE ip='$ip'";
	mysql_query($q, $this->connection) or die(mysql_error()); 
	$q = "DELETE FROM users_active WHERE user_id='$usersid'";
	mysql_query($q, $this->connection) or die(mysql_error());
	$q = "INSERT INTO users_active VALUES ('$usersid', '$userstime', '0')";
	mysql_query($q, $this->connection) or die(mysql_error()); 
	$this->calcNumActiveUsers();
}


function updateUserField($id, $field, $value)
{
	$q = "UPDATE users SET ".$field." = '$value' WHERE user_id = '$id'";
	return mysql_query($q, $this->connection);
}

 

so it should be working any ideas why its not?

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.