[eluser]mohsin917[/eluser]
Hi.
This is the thing that i do in simple code. Every time when this code runs it create new index of basket in session array and when i want to get data i just do it with simple loop.
Now i want to do it in CI using session class
Code:
$product_array = array(
"id" => $id,
"pName" => $_POST['pName'],
"pImage" => $_POST['pImage'],
"pCode" => $_POST['pCode'],
"price1" => $_POST['price1'],
"price2" => $_POST['price2'],
"price3" => $_POST['price3'],
"price4" => $_POST['price4'],
"quantity" => 1
);
$_SESSION['basket'][] = $product_array;
simply array is working in CI Session class. But can't add the session auto incremented array. Even i also try to do this.
Code:
$basket[] = array(
"id" => '1',
"pName" => "name",
"quantity" => 1
);
$this->session->set_userdata($basket);
but not helpful.
Any idea??