I am having trouble with Flash Messages when $config['sess_use_database']
is TRUE
. Whenever, it is FALSE
it works without any problems. Below is my code and my configuration file. Why does it not work when I try to store the sessions in the database?
Configuration File
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
Controller
$this->session->set_flashdata('item', array('message' => 'Record created successfully','class' => 'success'));
redirect('dashboard');
Dashboard View
if(!empty($this->session->flashdata('item'))) {
$message = $this->session->flashdata('item');
echo "<div class='" . $message['class'] . ">" . $message['message'] . "</div>";
}