Execute("select * from sondage"); while ($dsondage=$sondage->FetchNextObject(false)) { if ($date_courante > strtotime($dsondage->date_fin)) { //destruction des données dans la base $req = 'DELETE FROM sujet_studs WHERE id_sondage = ' . $connect->Param('id_sondage') . '; ' . 'DELETE FROM user_studs WHERE id_sondage = ' . $connect->Param('id_sondage') . '; ' . 'DELETE FROM comments WHERE id_sondage = ' . $connect->Param('id_sondage') . '; ' . 'DELETE FROM sondage WHERE id_sondage = ' . $connect->Param('id_sondage') ; $sql = $connect->Prepare($req); $connect->Execute($sql, array($dsondage->id_sondage)); // ecriture des traces dans le fichier de logs error_log($date . " SUPPRESSION: $dsondage->id_sondage\t$dsondage->format\t$dsondage->nom_admin\t$dsondage->mail_admin\n", 3, '../admin/logs_studs.txt'); } }