Welcome Guest, Not a member yet? Register   Sign In
Multidimensional session data
#1

[eluser]spheroid[/eluser]
How is it possible to do the following refactored for CI? Having difficulty compared to the documentation:

1. Increase the value by 1
Code:
$_SESSION['cart_product_qty'][$i]++;

2. Compare a multidimensional session array key
Code:
if ($_SESSION['cart_product_id'][$i] == $product_id) ...

3. Set a session variable using an array key
Code:
$_SESSION['cart_product_qty'][] = 1;

4. Display a multidimensional session variable
Code:
echo $_SESSION['cart_product_qty'][$i];

I'm not sure if it's possible to use these type of multidimensional session variables??
#2

[eluser]nmweb[/eluser]
I don't think it's possible right now in the way you described. It is however possible to serialize whichever arrays you have into a variable, unserialize them when you need them, and again serialize them and put them back in the session.

http://nl3.php.net/serialize




Theme © iAndrew 2016 - Forum software by © MyBB