I'm working on getting a login script to work. In the function below it is supposed to get the session_id and save it to the database. However, when i look in the database the session field is blank (but the ip is saving properly). Any ideas on why a session id is not being generated?

PHP Code:
        public function _setSession(&$values$remember$init true) {
$this->id $values['user_id'];
$_SESSION['uid'] = $this->id;
$_SESSION['username'] = htmlspecialchars($values['username']);
$_SESSION['cookie'] = $values['cookie'];
$_SESSION['logged'] = true;

                if (
$remember) {
$this->updateCookie($values['cookie'], true);

                if (
$init) {
$session session_id();

$this->db->saveRecord('users', array('session' => $session'ip' => $ip), array('user_id' => $this->id));
This is a sample array of the information as it is being sent to the method.

PHP Code:
Array ( [user_id] => [username] => bar338 [password] => my password in sha1 [cookie] => [session] => [ip] => my ip address [email] => my email address [user_level] => 10 [addDate] => 0000-00-00 00:00:00 [changeDate] => 2009-07-29 14:10:20 
and remember is set to true.

Thanks for the help.
The original script im modifying can be found here: