I currently have the following code:
$dbh = new PDO('mysql:host='.DATABASE_HOST.';dbname='.DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$dbh->prepare("INSERT INTO mdr_contacts SET fkRelatieId = 0, reseller = 0, code = :code, naam = :naam");
$dbh->execute(array(":code" => $contact["contact_id"],":naam" => $name));
However this seems to fail: Fatal error: Call to undefined method PDO::execute() in file.php on line 67
What i've done so far to make this work:
- Checked if
$nameand$contactexists and has the right value. - Executed a SELECT query before the prepare statement to make sure that PDO works.
- Runned the code without ATTR_EMULATE_PREPARES set to false.
But none of this works, can anyone set me in the right direction?