Welcome Guest, Not a member yet? Register   Sign In
session flashdata not work correctly in codeigniter 2.2
#7

(This post was last modified: 11-28-2014, 03:38 PM by Smith.)

Hello again,
I load library this way:

autoload.php
PHP Code:
$autoload['libraries'] = array('form_validation','input','session','template','database','breadcrumbs'); 

Also i try loading the library on the builder, but not working. In my config.php file on Session Variables i have this:

PHP Code:
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class or the Session class you
| MUST set an encryption key.  See the user guide for info.
|
*/
$config['encryption_key'] = '#Q@123VFDSdfd$';

/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_cookie_name'        = the name you want for the cookie
| 'sess_expiration'            = the number of SECONDS you want the session to last.
|   by default sessions last 7200 seconds (two hours).  Set to zero for no expiration.
| 'sess_expire_on_close'    = Whether to cause the session to expire automatically
|   when the browser window is closed
| 'sess_encrypt_cookie'        = Whether to encrypt the cookie
| 'sess_use_database'        = Whether to save the session data to a database
| 'sess_table_name'            = The name of the session database table
| 'sess_match_ip'            = Whether to match the user's IP address when reading the session data
| 'sess_match_useragent'    = Whether to match the User Agent when reading the session data
| 'sess_time_to_update'        = how many seconds between CI refreshing Session Information
|
*/
$config['sess_cookie_name']        = 'ci_session';
$config['sess_expiration']        = 7200;
$config['sess_expire_on_close']    = TRUE;
$config['sess_encrypt_cookie']    = TRUE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']        = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']    = 300

I Added the code you told me and I get this error:
Quote:A PHP Error was encountered

Severity: Warning

Message: Missing argument 1 for CI_Session::flashdata(), called in C:\xampp\htdocs\projects\application\controllers\test\user.php on line 81 and defined

Filename: libraries/Session.php

Line Number: 578
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: key

Filename: libraries/Session.php

Line Number: 580


the "$key" variable refers to the constant encryption_key?.
when i add this code:
PHP Code:
$this->session->set_flashdata('item''value');
echo 
$this->session->flashdata('item');
print_r($this->session->flashdata('item')); 

this not print anything on screen.
Again thank you for your response
Reply


Messages In This Thread
RE: session flashdata not work correctly in codeigniter 2.2 - by Smith - 11-28-2014, 03:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB