I have a PHP script that is executed daily by my server thanks to cron. This script contains PDO queries to add, edit, and delete data from my MySQL database. The script does not work as expected, especially the last part of the query which is supposed to remove some rows:
$stmt = $conn->prepare("DELETE FROM `mkgaction` WHERE score IS NULL");
$stmt->execute();
if($stmt->execute()) {
echo "delete succeeded<br>";
} else {
echo "delete failed<br>";
}
When executed manually via PHPMyAdmin, every query works fine. When executed via this script it does not work despite the message showing "delete succeeded". I suppose the best way to understand what actually happens is to read the response from the database, but I don't know how to do that. Would you help me? :-) Thanks
$stmt->execute()