For the sake of the thread I have only 2 PHP classes, one for the Database and one for Users in my database.
When running the executing the code in my Users class a PHP notice is displayed on my browser stating..
Notice: Undefined property: Database::$escape in /my/directory/user.class.php on line x
In my Users class I have the following code:
$Database = new Database();
$submitData = array_map($Database->escape, $submitData);
$result = $Database->query("SELECT user_id FROM users WHERE email_address = " . $Database->quote($formData['email_address']));
In my Database class I have the following:
class Database {
private $db = array();
private $connection;
public $result;
public function escape($data) {
return mysqli_real_escape_string($this->connection, $data);
}
...