A.imahrap A.imahrap - 4 months ago 11
PHP Question

how can i select this item in array?

Hello i made this query for wordpress plugin

$anyOne = $wpdb->get_results("SELECT MAX(id) as idlastest FROM " . $table_name_for_select . " WHERE drJlDate='".$dkdrbooking_for_compare."'");


the value in
$anyOne
is

Array ( [0] => stdClass Object ( [idlastest] => 32 ) )


I need to get 32 to use it in another query, but i can't select that. How can I get
idlastest
from this array ?
I tried this code, but it didn't work

echo 'lastestID is : '.$myIds[0]['idlastest'];

Answer

This is an object in your array, so use -> to get object value

echo 'lastestID is : '.$myIds[0]->idlastest;
Comments