What is best way to get and unserialize data in codeigniter? |
On my controller I need to be able to get some serialized data but keep on getting error below
A PHP Error was encountered Severity: Notice Message: Undefined offset: 0 Filename: common/Dashboard.php Line Number: 40 Backtrace: Var dump string(111) "a:3:{s:7:"user_id";s:2:"20";s:8:"username";s:20:"demo";s:4:"name";s:20:"John Doe";}" PHP Code: $results = $this->get_user_activities(); Model Function PHP Code: public function get_user_activities() { How come there is a offset error? And how can I fix it?
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
I am just confused on the best way
I tried this code below for getting seems to work but not sure if safe PHP Code: $key = unserialize($result['data']); PHP Code: foreach ($results as $result) {
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
|
Welcome Guest, Not a member yet? Register Sign In |