I am having trouble with unserialize method does not seem to work for my codeigniter project. What is the best method to unserialize with codeigniter php.

I get a error

A PHP Error was encountered

Severity: Notice

Message: unserialize(): Error at offset 67 of 139 bytes

Filename: extension/model_module.php

Line Number: 25

Model Function

public function getModule($module_id) {
        $query = $this->db->query("SELECT * FROM `" . $this->db->dbprefix . "module` WHERE `module_id` = " . $this->db->escape($module_id) . " ");

        if ($query->row()) {
            return unserialize($query->row('setting'));
        } else {
            return array(); 

I'm not too familair with CI, but have you tried to dump the serialized string? var_dump($query->row('setting'))

Doing that might possibly give you some more insight to why it's coming back with an error message.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.