php - session_id() is not entering in to DB? -


i able echo session_id() , that. can't seem enter session_id() table.

here function:

public function login($email, $password) {     $row = db::getinstance()->get('users', array('email', '=', $email));      $password = $row->first()->user_salt . $password;     $password = $this->hashdata($password);      $is_active = (boolean) $row->first()->is_active;     $is_verified = (boolean) $row->first()->is_verified;      if ($email == $row->first()->email && $password == $row->first()->password) {         $match = true;     } else {         $match = false;     }      if ($match == true) {         if ($is_active == true) {             if ($is_verified == true) {                 $random = $this->randomstring();                 $token = $_server['http_user_agent'] . $random;                 $token = $this->hashdata($token);                  $_session['token'] = $token;                 $_session['user_id'] = $row->first()->id;                 $userid = $row->first()->id;                 $session = session_id();                 echo $session;                  $deleteold = db::getinstance()->delete('active_users', array('user_id', '=', $userid));                  $insertnew = db::getinstance()->insert('active_users', array(                                 'user_id'       => $userid,                                 'session_id'    => $session,                                 'token'         => $token                             ));                   if ($insertnew != false) {                     return 0;                 }                 return 3;             } else {                 // not verified                 return 1;             }         } else {             // not active             return 2;         }     } 

as can see have declared $session = session_id(); , echo displays id no problem, when insert db, value stored 0. why can't store session_id()?

session_id() returns string, seems it's being saved integer in database. if change type of session_id varchar in db schema, should work.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -