php - "Undefined method PDO::execute()" despite using prepare -


this code has been working before, added database class. instance , connection it:

           $connection = mysqldatabase::getinstance()->getconnection();             $connection->prepare("insert users etc etc.......             $insertarray = $connection->execute(array(                 ":username" => $_post["username"]             )); 

getinstance() returns database instance. getconnection() returns connection property contains:

new pdo('mysql:host=' . db_host . ';dbname=' . db_name, db_user, db_pass); 

so error occurs when doing $connection->execute despite $connection contains database object, connection, , prepared statement. how can be?

create variable store prepared statement execute that.

$connection = mysqldatabase::getinstance()->getconnection(); $statement = $connection->prepare("insert users etc etc......."); $insertarray = $statement->execute(array(     ":username" => $_post["username"] )); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -