如何在PDO中删除文件

时间:2015-09-08 12:12:09

标签: php mysql pdo

我已经为我创建的删除临时表创建了一些编码。以下是编码。

for ($i = 0; $i < sizeof($What_services_post); $i++) {
     $sql = "SELECT `provider_id` FROM `provider_service_need` WHERE `service_need`='".$What_services_post[$i]."'";
     $stmt = $dbg->query($sql);
     foreach ($stmt as $row_service_need) {
         $p_id = $row_service_need['provider_id'];
         if ($result_looking_for) {   
             $sql = "SELECT `p_id` FROM `temprari_provider_filter_looking_for` WHERE `p_id`='$p_id' AND `f_id`='$finder_id' GROUP BY `p_id`";
             $stmt = $dbg->query($sql);
             $row_looking_temp2 = $stmt->fetch();
             if ($row_looking_temp2['p_id'] == $p_id) {
                 $result_filter_servic = $dbg->exec("INSERT INTO `temprari_provider_filter_service_need`(`p_id`, `f_id`) VALUES ('$p_id','$finder_id')") or die("Insert Failed ".mysql_error());

                 $count = $dbg->prepare("DELETE FROM `temprari_provider_filter_looking_for` WHERE `p_id`='$p_id' AND `f_id`='$finder_id'")or die("Delets Failed ".mysql_error());
                 $count->execute();
             } else {
                 $result_filter_servic=$dbg->exec("INSERT INTO `temprari_provider_filter_service_need`(`p_id`, `f_id`) VALUES ('$p_id','$finder_id')") or die("Insert Failed ".mysql_error());

                  $count=$dbg->prepare("DELETE FROM `temprari_provider_filter_looking_for` WHERE `p_id`='$p_id' AND `f_id`='$finder_id'")or die("Delets Failed ".mysql_error());
                  $count->execute();
             }
         } else {
            $result_filter_servic=$dbg->exec("INSERT INTO `temprari_provider_filter_service_need`(`p_id`, `f_id`) VALUES ('$p_id','$finder_id')") or die("Insert Failed ".mysql_error());
         }
    }
}

我想删除p_idf_id所有的数据。但它不起作用。而且我找不到假的。请有人帮助我。

0 个答案:

没有答案