Hiho, hänge grade an meiner PDO Klasse, die was in die Datenbank einfügen soll. Iwie klappt das net. Seht ihr den Fehler. Hier mein Code:
PHP-Code:
class Database
{
private $_db;
static $_instance;
private function __construct(){
$this->_db = new PDO('mysql:host=localhost;dbname=test', 'root', '');
}
public static function getInstance() {
if (!(self::$_instance instanceof self)) {
self::$_instance = new self();
}
return self::$_instance;
}
}
//Anwendung
$queryNewUserInsert = Database::getInstance()->prepare('INSERT INTO users (firstName, lastName) VALUES(`Max`, `Mustermann`)');
$queryNewUserInsert->execute();
Kommentar