Welcome Guest, Not a member yet? Register   Sign In
CI DB session not working
#1

[eluser]The Casual Bot[/eluser]
Hi All,

i cant get ci db sessions to work

so here what im doing to troubleshoot

Code:
<?php
class Auth extends Controller {
    function __construct()
    {
        parent::__construct();
       $this->load->library('session');

    }
    function index() {
            $this->output->enable_profiler(TRUE);
        


    $newdata = array(
                   'username'  => 'johndoe',
                   'email'     => '[email protected]',
                   'logged_in' => TRUE
               );

$this->session->set_userdata($newdata);
echo $this->session->userdata('session_id');

$query = $this->db->query('select * from ci_sessions');
echo '<pre>';
print_r($query);
echo '</pre>';
    }



}


so as you can see im just trying to drop the data into session it was not working so i turned profiler on and as you can see the insert and update statments are working

Code:
DATABASE:  see   QUERIES: 4  
0.0003      SELECT *
FROM (`ci_sessions`)
WHERE `session_id` = '931eee92cc2b38336c0aaedf6e72c9e2'
AND `user_agent` = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv'
0.0000      INSERT INTO `ci_sessions` (`session_id`, `ip_address`, `user_agent`, `last_activity`) VALUES ('750f1985afa1c339dd56f1b25cb8748a', '10.191.0.131', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv', 1275556167)
0.0002      UPDATE `ci_sessions` SET `last_activity` = 1275556167, `user_data` = 'a:3:{s:8:\"username\";s:7:\"johndoe\";s:5:\"email\";s:21:\"[email protected]\";s:9:\"logged_in\";s:1:\"1\";}' WHERE `session_id` = '750f1985afa1c339dd56f1b25cb8748a'
0.0002      select * from ci_sessions


and there no errors the output is

Quote:750f1985afa1c339dd56f1b25cb8748a

CI_DB_mysql_result Object
(
[conn_id] => Resource id #28
[result_id] => Resource id #34
[result_array] => Array
(
)

[result_object] => Array
(
)

[current_row] => 0
[num_rows] => 0
[row_data] =>
)

i have no idea what to do now
#2

[eluser]The Casual Bot[/eluser]
ow yeah my problem is there nothing in my db
#3

[eluser]The Casual Bot[/eluser]
i kinda fixed it it seems to users data colum in the session tabel was set to not null

but im still unshore why it did returm any errors




Theme © iAndrew 2016 - Forum software by © MyBB