Welcome Guest, Not a member yet? Register   Sign In
flashdata not working but userdata works
#9

[eluser]DrWaky[/eluser]
[quote author="WanWizard" date="1309317695"]No issues with flashdata here. If you create this test controller
Code:
class Flashdata extends MY_Controller {

    function __construct()
    {
        parent::__construct();

        $this->load->library('session');
    }

    function index()
    {
        if ($var = $this->session->flashdata('test'))
        {
            echo "Found data: $var";
        }
        else
        {
            $this->session->set_flashdata('test', 'flash data test');
            echo "Set data";
        }
    }
}
you'll see that it alternates between found and set, as designed.

You could have a flashdata issue if you use cookie based sessions (which you should not), use Internet Explorer, and redirects. Some IE versions ignore headers when they see a 'location' redirect in the header, which in case of session cookies means you lose that session update...[/quote]

But in this code the if
Code:
if ($var = $this->session->flashdata('test'))
works because it assign FALSE (an strange value of $this->session->flashdata('test')) to $var so, the calculated value to if condition is TRUE, so it work, cause the asignation in condition work fine

Try an echo of $var after de asignation please to see its content.


Messages In This Thread
flashdata not working but userdata works - by El Forum - 11-19-2008, 08:14 PM
flashdata not working but userdata works - by El Forum - 11-20-2008, 09:05 AM
flashdata not working but userdata works - by El Forum - 11-20-2008, 10:01 AM
flashdata not working but userdata works - by El Forum - 11-20-2008, 10:15 AM
flashdata not working but userdata works - by El Forum - 05-23-2011, 12:13 AM
flashdata not working but userdata works - by El Forum - 05-23-2011, 12:18 AM
flashdata not working but userdata works - by El Forum - 06-28-2011, 04:11 PM
flashdata not working but userdata works - by El Forum - 06-28-2011, 04:21 PM
flashdata not working but userdata works - by El Forum - 06-28-2011, 04:28 PM
flashdata not working but userdata works - by El Forum - 06-28-2011, 09:49 PM
flashdata not working but userdata works - by El Forum - 06-29-2011, 12:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB