会话只保存记录,而不是在PHP中保存其余的记录?

function  mycart($mydate=null,$day=null)
 {
  $mycart= $this->session->userdata('mycart');
  $totalprice=$this->session->userdata('totalprice');

    if($this->limitation($mydate) && (!(isset($mycart[$mydate]))) )
    {          
     $mycart[$mydate] = array(
     'meal' =>$this->session->userdata('meal'),
     'day' =>$day,
     'date' =>$mydate,
     'disable'=>FALSE,
     'flag'=>null);
     $this->session->set_userdata('mycart',$mycart);  

     $this->session->set_userdata('totalprice',$totalprice);
    }// end  of if        

 }//  end  of  function

I am saving an array called $mycart in session but only 10 carts, i.e, only 10 records are getting saved after which 11th one is not getting saved in session. The session only save 10 array element can any one tell me why??

Perhaps your issue is with your array itself. If you have two carts with the same $mydate value, the latter will override the first value. You need to use a multidimensional array in this case, i.e.:

$mycart[$mydate][] = array(
     'meal' =>$this->session->userdata('meal'),
     'day' =>$day,
     'date' =>$mydate,
     'disable'=>FALSE,
     'flag'=>null);

Otherwise you may perhaps be skipping with your first check on isset($mycart[$mydate]), which would essentially skip over an entire cart.

The code you've posted is irrelevant to the problem you describe.

Try creating code from scratch to replicate the issue.

C.