Jump to content

Call to undefined method PDOStatement::exec()


Recommended Posts

LAMP environment, PHP 5.4.13, MySQL 5.5.30.


Code snippet:

$db = new PDO('mysql:host=localhost;dbname=test',$username,$password);
$sql="INSERT INTO `atable`(
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$stmt = $db->prepare($sql);
$stmt->bindValue(':auser', $buser, PDO::PARAM_STR);
$stmt->bindValue(':aexpires', $bexpires, PDO::PARAM_STR);
$stmt->bindValue(':aapproved_by', $bmyNull, PDO::NULL_EMPTY_STRING);
$stmt->exec($sql) or die(print_r($db->errorInfo(), true)); 
Fatal error: Call to undefined method PDOStatement::exec() in ...
Any insights greatly appreciated!


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.