title: How to access stdClass variables stdClass Object([max(id)])=>64)
body: <p>I need the very last valid entry in a database table which would be the row with the greatest primary key. So using mysqli, my query is "SELECT MAX(id) FROM table LIMIT 1". This query returns the correct number(using print_r()) but I cannot figure out how to access it. Here is the main code. Note that the $this->link refers to class with a mysqli connection.</p>
  
  <pre><code>$q="select max(id) from stones limit 1";
      $qed=$this-&gt;link-&gt;query($q) or die(mysqli_error());
      if($qed){
          $row=$qed-&gt;fetch_object();
          print_r($row);
          echo $lastid=$row;//here is the problem
      }
  </code></pre>
  
  <p>The valid line print_r($row) echos out "stdClass Object ( [max(id)] => 68 )"</p>