kingy-en Posted September 16, 2008 Share Posted September 16, 2008 hi i have a parameter stored in a array. can anyone tell me how to call 114 out of this array stdClass Object ( [max(id)] => 114 ) its is comming from a sql query - SELECT MAX(id) FROM dev; any help will be amazing i have tried $var = $sql_result->id; $var = $sql_result->max; neither work unfortunately. Link to comment https://forums.phpfreaks.com/topic/124556-array-object-question/ Share on other sites More sharing options...
rarebit Posted September 16, 2008 Share Posted September 16, 2008 while ($a = mysql_fetch_array($sql_result)) { print $a['id'].": ".$a['name']." - ".$a['pass']."<br>"; } are iterating through the results object? Link to comment https://forums.phpfreaks.com/topic/124556-array-object-question/#findComment-643353 Share on other sites More sharing options...
trq Posted September 16, 2008 Share Posted September 16, 2008 use an alias in your query; eg. SELECT MAX(id) as maxid FROM dev Then you'll be able to refer to the value as $sql_result->maxid; Link to comment https://forums.phpfreaks.com/topic/124556-array-object-question/#findComment-643357 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.