I'm new to codeigniter framework. I have setup a Codeigniter v2 existing projects from github and the last couple of days I have had problems with the session.php file. All th values in the session variables are empty and I get the following error
A Database Error Occurred
Error Number: 1062
Duplicate entry '' for key 'PRIMARY'
INSERT INTO `stream_ci_sessions` (`session_id`, `ip_address`, `user_agent`, `last_activity`, `user_data`) VALUES ('', '', '', 1537445113, '')
Filename: libraries/Session.php
Line Number: 283
Session create part
function sess_create()
{
$sessid = '';
while (strlen($sessid) < 32)
{
$sessid .= mt_rand(0, mt_getrandmax());
}
// To make the session ID even more secure we'll combine it with the user's IP
$sessid .= $this->CI->input->ip_address();
$this->userdata = array(
'session_id' => md5(uniqid($sessid, TRUE)),
'ip_address' => $this->CI->input->ip_address(),
'user_agent' => substr($this->CI->input->user_agent(), 0, 120),
'last_activity' => $this->now,
'user_data' => ''
);
// Save the data to the DB if needed
if ($this->sess_use_database === TRUE)
{
$this->CI->db->query($this->CI->db->insert_string($this->sess_table_name, $this->userdata));
}
// Write the cookie
$this->_set_cookie();
}
Anyone who has been able to resolve such an error? Thanks