Welcome Guest, Not a member yet? Register   Sign In
Add Associative array to ci session
#1

[eluser]ecigraeme[/eluser]
Can anybody tell me the correct syntax to add an associative array into the session.

Im building a shopping cart that will use productID as the key then the value will represent the quantity of that item.

At the moment my session looks like this.

session_id:8e17001912ac8928bcc8268d15a1756f
ip_address:127.0.0.1
user_agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) Ap
last_activity:1232101098
474:2
471:4
746:1

This would mean I had 2 of product with id 474 and 4 of product with id 471 etc.

Currently i have a shopping cart model that pulls the cart from the session by only returning keys that satisfy is_numeric(), but i think it would be preferable if all the cart items were inside one session variable.

The code works as it is. Is it worth changing and how do i do it.

Thanks for your help

Graeme




Theme © iAndrew 2016 - Forum software by © MyBB