I ve created an email class that will add users to a mysql database. then I ve created two methods, the first is private static so I can access it within the second method which is public static, when run this class displays a blank page? What could be the cause of the blank page?
class Email {
private static function DATABASE() {
$dbh = new PDO("mysql:host=localhost;dbname=emails", bjw123nasd4441 , hj12j2kJKj11s );
return $dbh;
}
public static function addemail($email) {
$sqldata = array( email => $email);
$stat = Email::DATABASE();
$stat->prepare("INSERT INTO tasklist (email) VALUES (:email)");
$stat->execute($sqldata);
}
}
Email::addemail( foo@bar.com );
I get this error with PHP Display Errors..
Call to undefined method PDO::execute()