"call to undefined method pdo::execute()" Answer’s


->execute() is for prepared statements. e.g.

$stmt = $dbh->prepare('some query here');

You're trying to execute a query directly on the main DB object. For PDO, that means

 $dbh->exec('query goes here');

You really should look into prepared statements. You're vulnerable to SQL injection attacks as is, and since you're using PDO to begin with, it's basically unforgivable to NOT be writing safe queries.

Wednesday, March 31, 2021
answered 11 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :