Exemplo n.º 1
0
 static function deleteByClefunique($clefunique)
 {
     $query = "select distinct idfilm as idfilm from torrentfilm ";
     $query .= "where clefunique=" . \core\Mysqli::real_escape_string_html($clefunique);
     \core\Mysqli::query($query);
     $tfs = \core\Mysqli::getObjectAndClose(true);
     $query = "delete  from torrentfilm ";
     $query .= "where clefunique=" . \core\Mysqli::real_escape_string_html($clefunique);
     \core\Mysqli::query($query);
     $res = \core\Mysqli::nombreDeLigneAffecte() > 1;
     \core\Mysqli::close();
     foreach ($tfs as $k => $tf) {
         $query = "select count(*) as cpt from torrentfilm ";
         $query .= "where idfilm=" . \core\Mysqli::real_escape_string_html($tf->idfilm);
         \core\Mysqli::query($query);
         $re = \core\Mysqli::getObjectAndClose();
         if ($re->cpt === "0") {
             $res &= Film::delete($tf->idfilm);
         }
     }
     return $res;
 }