Hi I'm not sure if i should ask this question in the php or mysql section so sorry if its in the wrong place.
I have been building a drag and drop shopping cart which is nearly done. I have a div where you can drag items too puchase, once dragged the item is added to a session using ajax/php.
The php script i have is this.
PHP Code:
<?php
session_start();
$itemsInCart= array('id'=>$_GET['product'], 'quantity'=>$_GET['quantity'], 'size'=>$_GET['size']);
$arrayNumber= $_GET['array'];
$_SESSION['cart'][$arrayNumber] = $itemsInCart;
?>
So each image of a product in the cart has attributes of id (which is the unique id in my database), quantity, size which are stored in an array inside another array. which looks like this.
Code:
Array
(
[1] => Array
(
[id] => 1
[quantity] => 5
[size] => small
)
[2] => Array
(
[id] => 2
[quantity] => 3
[size] => Large
)
[3] => Array
(
[id] => 3
[quantity] => 5
[size] => medium
)
)
I have a database table with 5 fields, id, date, imageurl, productname and price.
The problem I'm having is i cant work out how to query mysql to get the imageurl based on the id's stored in the session, so that i can display the images in the cart div if the page is refreshed.
Can anyone point me in the right direction with this? I would really appreciate any help
Thanks
Bookmarks