Welcome Guest, Not a member yet? Register   Sign In
CI 3.02 - sess_use_database error
#1

Hi.

 I am receiveing an error where I try to put an array of data in session. It's an error that says that there is an error on UPDATE query for the session table, but my CodeIgniter is not using database session, but files instead.

Code:
Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET `last_activity` = 1444350425, `user_data` = 'a:9:{s:9:\"user_data\";s:0:\"\"' at line 1

UPDATE SET `last_activity` = 1444350425, `user_data` = 'a:9:{s:9:\"user_data\";s:0:\"\";s:6:\"logado\";s:1:\"1\";s:10:\"id_usuario\";s:2:\"17\";s:13:\"filtro_codigo\";s:0:\"\";s:4:\"tipo\";s:1:\"j\";s:12:\"nome_empresa\";s:0:\"\";s:12:\"nome_contato\";s:0:\"\";s:5:\"email\";s:0:\"\";s:8:\"telefone\";s:0:\"\";}' WHERE `session_id` = 'f5616d47a33c54d43612d425984edbcd'

Filename: libraries/Session.php

Line Number: 289


 The error ocurred in library/Session.php line 289. Then I went to that line and I saw that CodeIgniter checks if the user is using database in session trought that line: 256:

PHP Code:
        // Are we saving custom data to the DB?  If not, all we do is update the cookie
        
if ($this->sess_use_database === FALSE)
        {
            
$this->_set_cookie();
            return;
        } 

Then I noted that there is no "sess_use_database" index in config.php anymore, so I just added this index set it to FALSE and all worked. Like this in config.php

PHP Code:
$config['sess_use_database'] = FALSE


Why there is no that option anymore in config.php file if the Session.php class uses that?

Sorry my english. Smile

Fabio
Reply
#2

You didn't follow the upgrade instructions carefully and you're still using the CI2 Session class.
Reply
#3

(10-09-2015, 02:34 AM)Narf Wrote: You didn't follow the upgrade instructions carefully and you're still using the CI2 Session class.

But what I didn't understand is why CI3 is looking for a database session driver if in previous version I was not using session with database.

And why this code still remains there if options do not exist anymore in config file.


PHP Code:
if ($this->sess_use_database === FALSE

To do that upgrade, I must add that option in config.php file?

PHP Code:
$config['sess_use_database'] = FALSE


Thank you.
Fabio
Reply
#4

There are upgrade instructions that, as I said, you didn't follow carefully (if you did at all).

On the very first step, there's an important note that you've ignored, which is to delete the old files and not just copy-paste over them. That's where your problem comes from.
Reply
#5

(10-09-2015, 10:03 AM)Narf Wrote: There are upgrade instructions that, as I said, you didn't follow carefully (if you did at all).

On the very first step, there's an important note that you've ignored, which is to delete the old files and not just copy-paste over them. That's where your problem comes from.

Ok, I'll try that, thank you.

Fabio
Reply




Theme © iAndrew 2016 - Forum software by © MyBB