how do I get ID from this array?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

how do I get ID from this array?

Post by someguyhere »

Code: Select all

Array
(
    [0] => stdClass Object
        (
            [ID] => 115
        )

)
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: how do I get ID from this array?

Post by social_experiment »

$array[0]['ID'] ?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
fugix
Forum Contributor
Posts: 207
Joined: Fri Mar 18, 2011 8:01 pm

Re: how do I get ID from this array?

Post by fugix »

should be as social_experiment said...the $array will be whatever variable that your array is stored under
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

Re: how do I get ID from this array?

Post by someguyhere »

I did try that earlier, but it didn't work. I can't remember the error it gave me.

I ended up finding a way to pull the data in a way that created a more straight forward array that was easier to work with.
Post Reply