$db->beginTransaction();
$del = $db->prepare('DELETE FROM hesabat_filter WHERE model_id NOT IN (SELECT res_id FROM result)');
$del->execute();
$del = $db->prepare('DELETE FROM hesabat_istilik WHERE model_id NOT IN (SELECT res_id FROM result)');
$del->execute();
$del = $db->prepare('DELETE FROM hesabat_nem WHERE model_id NOT IN (SELECT res_id FROM result)');
$del->execute();
$del = $db->prepare('DELETE FROM hesabat_rek WHERE model_id NOT IN (SELECT res_id FROM result)');
$del->execute();
$del = $db->prepare('DELETE FROM hesabat_soyuqluq WHERE model_id NOT IN (SELECT res_id FROM result)');
$del->execute();
$del = $db->prepare('DELETE FROM hesabat_vent WHERE model_id NOT IN (SELECT res_id FROM result)');
$del->execute();
$db->commit();
$count = $del->rowCount();
echo $count;
儘管此PDO的工作正確,但我無法計算所有刪除的行。我想我應該給每個準備的查詢不同的變量,然後收集變量。你有什麼想法?我應該如何統計PDO中所有已刪除的行?
$每個查詢 –