Jump to content

session problem


dadamssg87

Recommended Posts

I'm writing a shopping cart type of application for booking something. The cart will holds items as arrays in the session. The problem i'm i'm having is i can store 5 items in my cart and then once i try to store any more, it just won't. I'm not getting any php errors. I'm using the codeigniter framework, so it may be a codeigniter session storage problem. Hopefully you guys can look at it and can see if you spot any bad logic that i'm overlooking.

 

<?php
                 //generates random unique 32 character string
	$booking_hash = random_string('unique');

	//set items foreach night
	foreach($room['date_rate'] as $date => $rate)
	{
                        //produces random sha1 16 char length string
		$sha1 = random_string('sha1', 16);

		$session['items'][$sha1] = array(
					'code'       => $room['code'],
					'id'         => $room_id,
					'title'      => $room['title'],
					'date'       => date("n/j/Y",strtotime($date)),
					'price'      => $rate,
					'tax_one'    => money_format('%i',$room['tax_one'] * $rate),
					'tax_two'    => money_format('%i',$room['tax_two'] * $rate),
					'sales_tax'  => 0,
					'guests'     => $num_guests,
					'booking'    => $booking_hash,	
					'deposit'    => $deposit,									
		);
	}


	$existing_items = $this->session->userdata('items');

  	if(!empty($existing_items))
 	{
		$session['items'] = $existing_items + $session['items'];
    }

	$this->session->set_userdata($session);


?>

 

I just read some codeigniter session documentation. It says the cookie it's using can hold 4KB of data. I have no idea how much text 4KB can hold...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.