I'm working on this small project and I can't move on. PDO is working perfectly in other queries, no problem there - I hope. I've checked the site and the previously asked questions did not help me
this is my code:
try { //Step 1
$stmt_dataliiParinte = $db->prepare('INSERT INTO parintei (numeParinte, prenumeParinte, adresaParinte, localitateParinte, codpostalParinte, telefonParinte, mobilParinte, emailParinte, profesiaParinte, locmuncaParinte) VALUES (:numeParinte, :prenumeParinte, :adresaParinte, :localitateParinte, :codpostalParinte, :telefonParinte, :mobilParinte, :emailParinte, :profesiaParinte, :locmuncaParinte) ON DUPLICATE KEY UPDATE emailParinte=VALUES(:emailParinte)');
print_r($stmt_dataliiParinte);
$stmt_detaliiParinte->execute(array(
':numeParinte' => $numeParinte,
':prenumeParinte' => $prenumeParinte,
':adresaParinte' => $adresaParinte,
':localitateParinte' => $localitateParinte,
':codpostalParinte' => $codpostalParinte,
':telefonParinte' => $phoneNumber,
':mobilParinte' => $phoneNumber2,
':emailParinte' => $emailParinte,
':profesiaParinte' => $profesiaParinte,
':locmuncaParinte' => $locmuncaParinte
));
$parinteID = $db->lastInsertId();
} catch(PDOException $e) {
$e->getMessage();
}
this is the print_r($stmt_dataliiParinte):
PDOStatement Object ( [queryString] => INSERT INTO parintei (numeParinte, prenumeParinte, adresaParinte, localitateParinte, codpostalParinte, telefonParinte, mobilParinte, emailParinte, profesiaParinte, locmuncaParinte) VALUES (:numeParinte, :prenumeParinte, :adresaParinte, :localitateParinte, :codpostalParinte, :telefonParinte, :mobilParinte, :emailParinte, :profesiaParinte, :locmuncaParinte) ON DUPLICATE KEY UPDATE emailParinte=VALUES(:emailParinte) )
so by the looks it's a PDOStatement object
I also tried to see if I have some variable error in the array so I also did an print_r on the execute array:
Array ( [:numeParinte] => dasda [:prenumeParinte] => dasdas [:adresaParinte] => dasdasd [:localitateParinte] => asdas [:codpostalParinte] => 23232 [:telefonParinte] => 1231231231231 [:mobilParinte] => 123123123123123 [:emailParinte] => x@x.com [:profesiaParinte] => asd [:locmuncaParinte] => dasdasdasd )
The names of the columns I've checked and double checked. I also tried removing the ON DUPLICATE KEY UPDATE, but with the same effect.
As I said before other queries work perfectly (example):
$stmt = $db->prepare('INSERT INTO tabere (dentabara,locatie,datastart,dataend,desctabara,pageID,tip,pret) VALUES (:dentabara, :locatie, :datastart, :dataend, :desctabara, :pageID, :tip, :pret)') ;
$stmt->execute(array(
':dentabara' => $dentabara,
':locatie' => $locatie,
':datastart' => $datastart,
':dataend' => $dataend,
':desctabara' => $desctabara,
':pageID' => $paginaTabara,
':tip' => $tip,
':pret' => $pret
));