I want to try to access my constructor $mysql that I have declared ouside the class ( When I put inside the class it wont work ) and I wanted to have access to it inside the methods that I create throught the all class.
Here is the code:
<?php
require_once ("db.php");
$mysql = new DbConnector();
class Validar
{
private $nifProgram;
private $checkProgram;
private $result;
public function getInfo($nifProgram, $checkProgram)
{
$this->nifProgram = $nifProgram;
$this->checkProgram = $checkProgram;
echo $this->nifProgram . " - " . $this->checkProgram;
$this->validate();
return $this->result;
}
private function validate()
{
}
}?>
If I put inside the class ( like the other variables are ) I get this error: syntax error, unexpected '$mysql', expecting 'function'
Thanks in advance
new Validar()?