This code has been working before, but I recently added a database class. I get the instance and connection from it:
$connection = MYSQLDatabase::getInstance()->getConnection();
$connection->prepare("INSERT INTO users etc etc.......
$insertArray = $connection->execute(array(
":username" => $_POST["username"]
));
getInstance() returns the database instance. getConnection() returns the connection property which contains:
new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS);
So the error occurs when doing $connection->execute despite that $connection contains the database object, the connection, and the prepared statement. How can this be?
Create a variable to store your prepared statement then execute that.