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
https://forums.phpfreaks.com/topic/96473-using-arrays/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.