I have made a library class in php which can get data from my database table settings. I can get information if it is not serialized. But I would like to know on my get function what would be best method to be able to return unserialise information just incase it is serialized. <?php class Settings { private $data = array(); public function __construct() { $this->CI =& get_instance(); } public function get($key = NULL) { if ($key != NULL) { $value = $this->get_where($key); return $value; } else { return FALSE; } } public function get_where($key = NULL) { if ($key …

Member Avatar
Member Avatar
+0 forum 1

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(); } }

Member Avatar
Member Avatar
+0 forum 1

Receiving this CodeIgniter message in my error log every so often (and by every so often I mean quite often): ERROR - 2013-07-21 07:26:40 --> Severity: Notice --> unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Error at offset 124 of 187 bytes /home/daniweb/httpdocs/system/libraries/Session.php 724 Could a problem unserializing() be caused by a session cookie size that is too big (and therefore the serialized version wasn't fully writen)? I encrypt session cookies. My session cookie is fine by a long shot, but I'm wondering if this could be an issue for others??

Member Avatar
Member Avatar
+0 forum 15

I want to store my array into my database using jQuery. Here is my code i'm using serialize(); function. Its storing correctly but when i unserialize(); nothing happening. Please help here is my code. <script> $(document).ready(function(){ $("#save-skills").click(function(){ var skills = $('input[name="skills[]"]').serialize(); console.log(skills); $('#loading').css('display', 'block'); var queryString = "skills=" + skills + ""; $.ajax({ url: 'save_skills.php', cache: false, contentType: "application/json; charset=utf-8", dataType:'json', async: false, type:'GET', data: queryString, success: function(data){ $('#loading').css('display', 'none'); if('error' in data){ $(".re_skills_success").hide(100); $(".re_skills_err").text(data.error); $(".re_skills_err").slideDown(400).delay(3000).slideUp(400); }else if('success' in data){ $(".re_skills_err").hide(100); $(".re_skills_success").text(data.success); $(".re_skills_success").slideDown(400).delay(3000).slideUp(400); } } }); }); }); </script> <!-- Unserialize() code --> $who = $_COOKIE['Email']; $skills = @mysql_query("SELECT * …

Member Avatar
Member Avatar
+0 forum 4

My final question. I have values which have been serialized into a table forum_polls as are in the following format as shown in the two examples below: [CODE]a:2:{i:0;a:2:{s:6:"answer";s:3:"Yes";s:5:"votes";s:1:"1";}i:1;a:2:{s:6:"answer";s:2:"NO";s:5:"votes";s:1:"2";}}[/CODE] [CODE]a:5:{i:0;a:2:{s:6:"answer";s:2:"CA";s:5:"votes";s:1:"1";}i:1;a:2:{s:6:"answer";s:4:"CIMA";s:5:"votes";s:1:"1";}i:2;a:2:{s:6:"answer";s:4:"ACCA";s:5:"votes";s:1:"0";}i:3;a:2:{s:6:"answer";s:5:"CIPFA";s:5:"votes";s:1:"1";}i:4;a:2:{s:6:"answer";s:24:"MBA(specify in comments)";s:5:"votes";s:1:"1";}}[/CODE] which unsererilized (I cheated and used an online unserializer) give: [CODE]array ( 0 => array ( 'answer' => 'Yes', 'votes' => '1', ), 1 => array ( 'answer' => 'NO', 'votes' => '2', ), )[/CODE] and [CODE]array ( 0 => array ( 'answer' => 'CA', 'votes' => '1', ), 1 => array ( 'answer' => 'CIMA', 'votes' => '1', ), 2 => array ( 'answer' => 'ACCA', 'votes' => …

Member Avatar
Member Avatar
+0 forum 2

The End.