Right now I am using Insert Ignore to insert a bunch of tuples into my DB. However, I want to know whether or not the tuple was actually inserted or not and based on that do some action. Code is in PHP:
if(!($stmt4 = $mysqliprivate3->prepare("INSERT IGNORE INTO ".$table." VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"))){
echo "Prepare Failed3: (" . $mysqliprivate3->errno . ") " . $mysqliprivate3->error;
}
else{
$stmt4->bind_param("ssisssssssssssss", $id, $dt, $score, $question1, $question2, $question3,$question4,$question5,$question6,$question7,$question8,$question9a,$question9b,$question9c,$question9d,$question9e);
$stmt4->execute();
$stmt4->close();
}
//if(inserted){
Do something
}
I have tried using
echo $mysqliprivate3->affected_rows;
but it seems to give me a 1 even if it isn't inserting anything. What else could I do?
Thanks,