mardi 22 août 2017

PDO::execute always returns FALSE but the query was succwssful

I'm trying to get a confirmation about saved row in DB, but my condition returnes always FALSE

$conn = new PDO($dir) or die("hovno");
$query = "INSERT INTO sncheck (caseId, snPaper, snBox, snUnit) VALUES ('$caseId', '$snPaper', '$snBox', '$snUnit')";
$prep = $conn->prepare($query);
if($prep->execute()){
    print "DONE";
}
else{
    print "ERROR";
}

It always triggers the else statement.

Aucun commentaire:

Enregistrer un commentaire