Results 1 to 1 of 1

Thread: Help with dyamic images

  1. #1
    Join Date
    Mar 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Help with dyamic images

    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
    Last edited by Snookerman; 04-23-2009 at 05:58 AM. Reason: added [code] tags

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •