Jump to content

Retrieving array value


sdaspen

Recommended Posts

I have an array that I can view if i print_r($uroutput) (see results below).
How do I grab the [rating] value of 2 to be displayed elsewhere on the page.

Thanks,



stdClass Object
(
[result] => Resource id #20
[numrows] => 1
[rows] => Array
(
[0] => Array
(
[id] => 32
[userid] => [email protected]
[portal_id] => 286
[channel_id] => 761
[package_id] => 2252
[rating] => 2
)

)

[statuscode] => 1
)
Link to comment
https://forums.phpfreaks.com/topic/11337-retrieving-array-value/
Share on other sites

According to the output, it's an object

[code]stdClass Object
(
    [result] => Resource id #20
    [numrows] => 1
    [rows] => Array
    (
        [0] => Array
        (
            [id] => 32
            [userid] => [email protected]
            [portal_id] => 286
            [channel_id] => 761
            [package_id] => 2252
            [rating] => 2
        )

    )

    [statuscode] => 1
)[/code]

so probably

[code]$rating = $uroutput->rows[0]['rating'];[/code]
Link to comment
https://forums.phpfreaks.com/topic/11337-retrieving-array-value/#findComment-42640
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.