Jump to content

[SOLVED] Maximum length of a session variable value


techtheatre

Recommended Posts

Is there a maximum length of a value stored in a session variable?  I have written a basic shopping cart in PHP and am adding the selected products and options to a single session variable (probably not the best idea, but i don't know what else to do) and i wonder if it would be possible that this string gets too long and products are "forgotten"?  I know there is a cut-off length when posting variables from a form using GET, but i am using POST, then combining the data into one (long) string and storing it in

$_SESSION['cartcontent'] = "mylongstringhere|seconditemhere|thirditemhere|fourthitemhere"

 

I have googled for "PHP Max Length Session Variable" and not found any info about this.  Thanks.

Thanks.  I wanted to check before I put too much more energy into this particular part of the script.  If i was going to run into a problem, i thought it better to change the process now rather than further down the road.  I will leave this as "unresolved" for a couple days in case someone else knows of a limit, but thanks for your response!  ;D

well instead of using the sessiocn as your cart, id write all the items into a database.  like id have an item number, a user id, and a cart id.  then a date or something, then the item name

 

this way you can veiw a particular cart simply by calling its id...... maybe store the id in a session or something.  that way you can always come back to the cart if theres an error or something, or dispute etc.

 

good luck, if you want me to expand, please pm me

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.