Chris
Chris

Reputation: 21

Get value from array

how can I echo the 33 form this printed array directly?

Array ( [0] => stdClass Object ( [max(renr)] => 333 ) )

Thanks

Upvotes: 0

Views: 222

Answers (4)

MJH
MJH

Reputation: 633

Use [] for array and -> for objects

Upvotes: 0

ThiefMaster
ThiefMaster

Reputation: 318758

Use an alias in your SQL query so you have an alphanumeric column name in the result set. That's the only real solution.

SELECT MAX(renr) AS max_renr FROM ....

and then $arr[0]->max_renr in your php code.

Upvotes: 0

gen_Eric
gen_Eric

Reputation: 227310

$array[0]->{'max(renr)'}

Upvotes: 3

jon_darkstar
jon_darkstar

Reputation: 16788

Well that's gonna depend on your language, but assuming PHP from the look of it...

$arr[0]->max(renr)

But to be far, I don't know what an index of max(renr) means

Upvotes: 0

Related Questions