call a class in another class
<p>Hi I have some problem to call a class in another class, below code the 1 is ok to show result, but in 2 use the same code add to another class, I don't know why it is not work.<br>
Thanks.</p>

<p>1</p>

<pre><code>require 'database.php';
$database = new Database();

$database-&gt;query('SELECT user_id, user_email FROM tb WHERE user_id = :user_id');
$database-&gt;bind(':user_id', '1');
$rows = $database-&gt;resultset(); // fetchall

echo "&lt;pre&gt;";
print_r($rows);
echo "&lt;/pre&gt;";
</code></pre>

<p>2</p>

<pre><code>require 'database.php';
$database = new Database();

class test{
    public function testf(){
        print"log";
        $database-&gt;query('SELECT user_id, user_email FROM tb WHERE user_id = :user_id');
        $database-&gt;bind(':user_id', '1');
        $rows = $database-&gt;resultset(); // fetchall

        echo "&lt;pre&gt;";
        print_r($rows);
        echo "&lt;/pre&gt;";
        print"log";
    }
}
$foo = new test();
$foo -&gt; testf();
</code></pre>
