Welcome Guest, Not a member yet? Register   Sign In
Using Flashdata to pass data through a redirect()
#11

[eluser]WanWizard[/eluser]
There's no extra DB read involved, the session record is read into memory when you start the session.

I do find it a bit annoying however that every time you update a session variable it results in a row update. I solved that by overloading sess_write() in my MY_Session library:
Code:
// -----------------------------------------------------------------
/**
* Write the session data
*
* Our version only writes when we want to, CI calls sess_write() way to often!
*
* @access    public
* @return    void
*/
function sess_write($write = FALSE)
{
    if ($write)
    {
        parent::sess_write();
    }
}

and then calling it explicitly at the end of my page processing by passing the parameter TRUE.

Side-effect is that you lose your session updates if you do a redirect, so extend that as well so you can do a sess_write(TRUE) before redirecting...




Theme © iAndrew 2016 - Forum software by © MyBB