Welcome Guest, Not a member yet? Register   Sign In
codeigniter + session problem again.. :S
#1

[eluser]Eren[/eluser]
here is my code

this is my broadcast bekle2.php page
Code:
if($this->broadcast_model->addbroadcast($bdata)){
                $newdata = array(
                'broadcastid'=>$bdata['broadcast_id']
                );
                $this->session->set_userdata($newdata);
                
                redirect(base_url().'broadcast/basla','refresh');
            }

and this is my broadcast_basla.php code
Code:
if(!$this->session->userdata('broadcastid')){
            var_dump($this->session->userdata('broadcast_id'));
            //redirect(base_url());
        }
session turns into false;;
i'm sure that $bdata['broadcast_id'] is not null Sad

plz help me to fix this
#2

[eluser]imn.codeartist[/eluser]
Debug your code and print if session carries the value before you redirect

Code:
if($this->broadcast_model->addbroadcast($bdata)){
                $newdata = array(
                'broadcastid'=>$bdata['broadcast_id']
                );
                $this->session->set_userdata($newdata);

                //added code
                echo $this->session->set_userdata($newdata);
                exit;
                
                redirect(base_url().'broadcast/basla','refresh');
            }
#3

[eluser]Colin Williams[/eluser]
Look closer
#4

[eluser]Eren[/eluser]
[quote author="dixcoder" date="1255057500"]Debug your code and print if session carries the value before you redirect

Code:
if($this->broadcast_model->addbroadcast($bdata)){
                $newdata = array(
                'broadcastid'=>$bdata['broadcast_id']
                );
                $this->session->set_userdata($newdata);

                //added code
                echo $this->session->set_userdata($newdata);
                exit;
                
                redirect(base_url().'broadcast/basla','refresh');
            }
[/quote]

it gaves me a blank page ???
#5

[eluser]imn.codeartist[/eluser]
You have used function not correctly.
Code:
$this->session->set_userdata($newdata);

it suppose to be

Code:
$this->session->set_userdata('session_name',$newdata);

as you are missing out the session variable name
#6

[eluser]zovar[/eluser]
Oups, posted a wrong suggestion. Sorry...




Theme © iAndrew 2016 - Forum software by © MyBB