File: /var/www/content-sp/cron/test_file.php
<?php
include("config.php");
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$SP_QUESTION = 'contentserver_202130.csp_sp_question';
$SP_QUESTION_MEDIUM = 'contentserver_202130.csp_sp_question_medium_wise';
$offset = $_REQUEST['off'];
$curDate = date('Y-m-d H:i:s');
// $getQuestion = $live->query("SELECT q.id,q.question_id,q.medium_id FROM h7382406836182.wp_aat93akkcv_sp_exam_question_linkage as s LEFT JOIN contentserver_202130.csp_sp_question_medium_wise as q on q.question_id=s.question_id where s.exam_type_id='47897' and s.subject_id='47899' order by s.question_id");
if ($offset != '') {
$getQuestions = $live->query("SELECT question_id FROM $SP_QUESTION where master_id='84' and subject_id='8360' order by question_id asc limit $offset,50");
// $getQuestions = $live->query("SELECT question_id FROM $SP_QUESTION where master_id='84' and subject_id='8360' order by question_id asc");
echo $live->error;
$i = $offset+1;
$server = "sarkari_pariksha,csc-olympiad";
$ques_of = explode(',', $server);
$quesOfjson = json_encode($ques_of, JSON_UNESCAPED_UNICODE);
foreach ($getQuestions as $q) {
echo "<br>";
echo $i . '--' . '--' . $q['question_id'];
$qId = $q['question_id'];
if ($qId != '0' && $qId != '') {
// echo "UPDATE $SP_QUESTION set question_of='$quesOfjson',question_flag='1' where question_id='$qId'";
// echo "<br>";
// echo "UPDATE $SP_QUESTION_MEDIUM set last_update_on='$curDate' where question_id='$qId' and medium_id='2'";
// $live->query("UPDATE $SP_QUESTION set question_of='$quesOfjson',question_flag='1' where question_id='$qId'");
// $live->query("UPDATE $SP_QUESTION_MEDIUM set last_update_on='$curDate' where question_id='$qId' and medium_id='2'");
}
$i++;
}
}