File: /var/www/content-sp/work-sp/delete_master_ques.php
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include 'config.php';
$SP_QUESTION = 'csp_sp_question';
$SP_MASTER_STRUCTURE = 'csp_sp_master_structure';
$SP_QUESTION_MEDIUM_WISE = 'csp_sp_question_medium_wise';
$master_id = $_REQUEST['m'];
$offset = $_REQUEST['off'];
// if ($offset != '') {
//echo "SELECT question_id,oly_id,add_date FROM $SP_QUESTION where master_id='$master_id' limit $offset,500";
$getQues = $conn->query("SELECT question_id FROM $SP_QUESTION where topic_id='8878' order by add_date desc");
$i = 1;
echo '<br>';
foreach ($getQues as $q) {
echo $i . '-';
echo $ques = $q['question_id'];
// echo $q['oly_id'].'-';
// echo $q['add_date'];
if ($ques != '' && $ques != '0') {
// $runquery = "DELETE FROM $SP_QUESTION where topic_id='8878' and question_id='$ques'";
// if ($conn->query($runquery)) {
// echo "deleted";
// $runSecquery = $conn->query("DELETE FROM $SP_QUESTION_MEDIUM_WISE where question_id='$ques'");
// }
}
echo '<br>';
$i++;
}
// }
// echo $deleteStructure = "DELETE FROM $SP_MASTER_STRUCTURE where master_id='$master_id'";
// if($conn->query($deleteStructure)) {
// echo "delete structure";
// }