CHttpSession problem

Why CHttpSession only working in my local sever, but not in my live server.

The code:




$session=new CHttpSession;

$session->open();

$sponsorID=$session['username'];

foreach($session as $name=>$value)

	$session['username']=$_GET['id'];

			

echo $session['username'];



In live server, echo $session[‘username’];, is not show anytings.

Thanks

Are you sure you have saved anything in your session? And btw. this loop doesn’t make much sense to me:


foreach($session as $name=>$value)

        $session['username']=$_GET['id'];



I just following example code at http://www.yiiframework.com/doc/api/CHttpSession.

In fact I really need some advices how to use CHttpSession to capture data, save it, anda show it again.

Thanks.

It’s very easy:


// Write value:

$session=Yii::app()->session;

$session->open();

$session['username']=$something;


// Read value in a later request:

$session=Yii::app()->session;

$session->open();

$name=$session['username'];

Thank you Mike… :)

Thank you Mike… :)