php class access variable
<p>I have the following PHP class:</p>

<pre><code>class connect {

public function __construct() {

$sql = new mysqli(...);

return $sql;

}
</code></pre>

<p>(Of course, this is not the whole code, just to give you the idea.</p>

<p>I then have:</p>

<pre><code>class two {

public function validateInput($input) {

$dbconn = new connect();

return $dbconn-&gt;real_escape_string($input);
</code></pre>

<p>}</p>

<p>However, this generates an error. How can I call the real_escape_string method on the $sql variable from class connect?</p>

<p>Cheers!</p>

<p>PS: Update, the error is Fatal error: Call to undefined method connect::real_escape_string()</p>
