Jump to content

Using arrays


thomashw

Recommended Posts

I have an array of which I want to use to query my database.

 

The key(s) of the array depends on what the user clicks on on my website.

 

Array
(
    [cart] => Array
        (
            [2] => Array
                (
                )

            [1] => Array
                (
                )

        )

)

 

That's how the array is set up, and can be added to as well. I want to query the database depending on the keys (as you can see they aren't in numerical order, and can really be any number.)

 

How can I use these keys to query the database? I'd need to use a loop, as I need to use these keys to extract multiple things.

 

I tried using the SELECT statement where I said the id = $_SESSION['cart'] but I just got errors.

 

Thanks! :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.