Welcome Guest, Not a member yet? Register   Sign In
Cannot unserialize ci_sessions from database

I try to create realtime monitoring user using session database.
I've can unserialize ci_sessions in codeigniter 2.x.x, but in Codeigniter 3.x.x I can't. After I use var_dump there is defferent format, like this

This is from codeigniter 2.x.x
string(174) "a:5:{s:9:"user_data";s:0:"";s:12:"namapengguna";s:21:"[email protected]";s:8:"platform";s:11:"Windows 8.1";s:7:"browser";s:20:"Chrome 41.0.2272.118";s:9:"logged_in";b:1;}"

This is from codeigniter 3.x.x
string(186) "__ci_last_regenerate|i:1428652689;idpengguna|s:0:"";idgrup|s:0:"";namapengguna|s:21:"[email protected]";platform|s:11:"Windows 8.1";browser|s:20:"Chrome 41.0.2272.118";logged_in|b:1;"

I think in codeigniter doesn't have "{" "}" in column data.

This is my error code
A PHP Error was encountered

Severity: Notice

Message: unserialize(): Error at offset 0 of 186 bytes

Filename: rmonitoring/Data.php

Line Number: 37


File: D:\htdocs\ci_for_basic\application\models\rmonitoring\Data.php
Line: 37
Function: unserialize

File: D:\htdocs\ci_for_basic\application\controllers\Rmonitoring.php
Line: 37
Function: get_data_monitoring

File: D:\htdocs\ci_for_basic\index.php
Line: 292
Function: require_once

and This is my PHP Code
PHP Code:
$data = array(
       $query $this->db->get("ci_sessions");
       foreach ($query->result() as $row)
           $udata unserialize($res);
               echo $row->ip_address;
               echo $udata['namapengguna'];
               echo date("d-m-Y H:i:s",$row->timestamp);
               echo $udata['browser'];
               echo $udata['platform'];

So what's wrong i my code ? Can you help me ?   Sad

Messages In This Thread
Cannot unserialize ci_sessions from database - by pudyastoadi - 04-10-2015, 01:27 AM

Theme © iAndrew 2016 - Forum software by © MyBB