taveleiro Posted September 18, 2013 Share Posted September 18, 2013 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`( `user`, `expires`, `approved_by`,... ) VALUES ( :auser, :aexpires, :aapproved_by,... )"; $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)); Error: Fatal error: Call to undefined method PDOStatement::exec() in ... Any insights greatly appreciated! Quote Link to comment Share on other sites More sharing options...
Solution AbraCadaver Posted September 18, 2013 Solution Share Posted September 18, 2013 Maybe because there is no exec() method: http://us2.php.net/manual/en/pdostatement.execute.php Quote Link to comment Share on other sites More sharing options...
taveleiro Posted September 18, 2013 Author Share Posted September 18, 2013 (edited) Thanks Cracka, highly embarrassed! Last line should have read: $stmt->execute() or die(print_r($db->errorInfo(), true)); Edited September 18, 2013 by taveleiro Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted September 18, 2013 Share Posted September 18, 2013 Use The Force young taveleiro. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.