In my PHP project I put 0 to the sessionID when the user is registered and I want to get the current logged in sessionid and update the value and save and use it for the web socket . and i used for the following functions
for getting the current logged in session
public function getSessionID(){
$ss = session_id();
var_dump($ss);
return $ss;
}
for update the session id
public function updateSession(){
$stmt = $this->db->prepare("UPDATE `users` SET `sessionID` = :sessionID WHERE `id` :id");
$stmt->bindParam(":sessionID",$this->sessionID,PDO::PARAM_STR);
$stmt->bindParam(":id",$this->id,PDO::PARAM_INT);
//var_dump($this->sessionID);
$stmt->execute();
}
but when var_dump($ss) it look like "string 'ck3o7jj67av14ciri14pjvnkks' (length=26)"
and also whenvar_dump($this->sessionID) in the updatesession method it look like "string 'ck3o7jj67av14ciri14pjvnkks' (length=26)" and it didn't change the value of the sessionID in the database . i don't know why it did not work!! please help me!