PHP object can not access variable
<p>Using the following:</p>

<pre><code>$last_book = tz_books::getLast($request-&gt;db, "WHERE book_id='{$request-&gt;book_id}'");
</code></pre>

<p>I get the following php object array,</p>

<pre><code>[0] =&gt; tz_books Object
    (
        [db:tz_books:private] =&gt; com Object

        [id] =&gt; 64BEC207-CA35-4BD2
        [author_id] =&gt; 4F4755B4-0CE8-4251
        [book_id] =&gt; 8FC22AA0-4A60-4BFC
        [date_due] =&gt; variant Object

    )
</code></pre>

<p>I then want to use the author_id, but for some reason it's not working.</p>

<p>Trying to use:</p>

<pre><code>$tz_books-&gt;author_id;
</code></pre>

<p>Using print_r($last_book); prints the array to the console just fine. And Doing the following just to see if the correct variable was being used:</p>

<pre><code>$author = $tz_books-&gt;author_id;
print_r($author);
</code></pre>

<p>Nothing is printed to the console, and even after digging through the php manual and trying a lot of alternatives, I can't seem to grab that variable. I'm hoping i'm making a rookie mistake and overlooking something stupid. Thank you for any help!</p>

<p>Edit: Class definition</p>

<pre><code>private $db;
public $id;
public $author_id;
public $book_id;
public $date_due;

public function __construct($db, $values=null) {
    $this-&gt;db = $db;
    if ( $values != null ) {
        foreach ( $values as $var =&gt; $value ) {
            $this-&gt;$var = $value;
        }
    }
}

public static function retrieveAll($db, $where='', $order_by='') {
    $result_list = array();
    $query = 'SELECT '.
            'id, '.
            'author_id, '.
            'book_id, '.
            'date_due '.
        "FROM tz_books $where $order_by";

    $rs = $db-&gt;Execute($query);

    while ( !$rs-&gt;EOF ) {
        $result_list[] = new tz_books($db, array(
            'id' =&gt; clean_id($rs-&gt;Fields['id']-&gt;Value),
            'author_id' =&gt; clean_id($rs-&gt;Fields['author_id']-&gt;Value),
            'book_id' =&gt; clean_id($rs-&gt;Fields['book_id']-&gt;Value),
            'date_due' =&gt; $rs-&gt;Fields['date_due']-&gt;Value,
        ));
        $rs-&gt;MoveNext();
    }
    $rs-&gt;Close();
    return $result_list;
}
</code></pre>
