} $rptrName = mysqli_real_escape_string($con, $_POST['rptrName']); $rptrDesig = mysqli_real_escape_string($con, $_POST['rptrDesig']); $rptrDept = mysqli_real_escape_string($con, $_POST['rptrDept']); $insType = mysqli_real_escape_string($con, $_POST['insType']); if ($insType == 1) { // $rptrStatePub = $_POST['rptrStatePub']; $rptrOrgPub = $_POST['rptrOrgPub']; // $rptrState = getStateNameByID($rptrStatePub); $rptrOrg = getPremNameByID($rptrOrgPub); } else { // $rptrState = mysqli_real_escape_string($con, $_POST['rptrStatePri']); $rptrOrg = mysqli_real_escape_string($con, $_POST['rptrOrgPri']); } $rptrState = $_POST['rptrState']; $rptrState = getStateNameByID($rptrState); $rptrAddrs = mysqli_real_escape_string($con, $_POST['rptrAddrs']); $rptrCntct = mysqli_real_escape_string($con, $_POST['rptrCntct']); $rptrEmail = mysqli_real_escape_string($con, $_POST['rptrEmail']); $rptrDateofRpt = mysqli_real_escape_string($con, $_POST['rptrDateofRpt']); $rptrDateofRpt = dateConverter($rptrDateofRpt); $rptVerName = mysqli_real_escape_string($con, $_POST['rptVerName']); $rptrVerDesig = mysqli_real_escape_string($con, $_POST['rptrVerDesig']); $rptrCmt = mysqli_real_escape_string($con, $_POST['rptrCmt']); $lol = json_encode($_POST); $query = "INSERT INTO adrdata\n(adrDataIDAI, adrFormID, Adrno, Madracno, CCIN, Source, \n\tState, Inst, report_type, age, age_unit, age_group, \n\twt, sex, ethnic, race, onset_date, date_end_reaction, \n\tonset_time, onset_time_unit, extent, notes, atccode, outcome, \n\treaction_subsided, reaction_reappeared, reaction_treatment, date_of_death, death_code, reaction_relation, \n\tlab_data, history, historyStDate, historyEndDate, historyCont, `status`, \n\treporter_name, reporter_dept, report_date, reporter_faxno, reporter_comment, reporter_org, \n\treporter_telno, reporter_email, reporter_address, reporter_state, madrac_action, total_drugs, \n\tdechall, rechall, causality1, causality2, pred_code, add_info, \n\trep_who, adr_type, icdcode, adr_desc, initial, madrac, \n\tweb_hosp, desig, partbody, literature_ref, study_name, lastMenDate, \n\tgesPer, gesPerUnit, weight, height, seriousness, seriousnessCrit, \n\trt1stTime, rt1stTimeUnit, rtLastTime, rtLastTimeUnit, causeOfDeath, autopsyYesNo, \n\tautopsyText, report_comment, ADR_ORIGIN, ADR_CURRENTSTAT, senderIden, dateRcv, \n\tAdrdatacol, study_type, reportInit, pregnancyStat, allergyStat, allergyText,\n\tcaseType, ptDOB, rptVerName, rptrVerDesig,\n\tchInitial, chAge, chAgeUnit, chAgeGrp, chSex,\n\tprimRptrQuali, primRptrName, primRptrDesig, primRptrState, primRptrOrg, primRptrDept, primRptrAddrs,\n\tinitRptNum)\nVALUES (NULL, {$formID}, '', '', '', {$primSource}, \n\t'', '', 0, '{$ptAge}', {$ptageUnit}, {$ptAgeGrp}, \n\t'', '{$sex}', '{$ethnic}', '', '', '', \n\t0, 0, '', '', '', '', \n\t'', '', '', '', '', '', \n\t'{$relInves}', '{$history}', '{$historyStDate}', '{$historyEndDate}', {$historyCont}, '{$status}', \n\t'{$rptrName}', '{$rptrDept}', '{$rptrDateofRpt}', '', '', '{$rptrOrg}', \n\t'{$rptrCntct}', '{$rptrEmail}', '{$rptrAddrs}', '{$rptrState}', '', 0, \n\t'', '', '', '', '', '', \n\t'', '', '', '{$adrDesc}', '{$ptInitial}', '', \n\t'', '{$rptrDesig}', '', '', '', '{$lastMenDate}', \n\t{$gesPer}, {$gesPerUnit}, {$weight}, {$height}, {$seriousness}, '{$seriousnessCrit}', \n\t0, 0, 0, 0, '', 0, \n\t'', '{$rptrCmt}', '', '', '{$senderIden}', '{$dateRptRcv}', \n\t'', '', {$reportInit}, {$pregnancyStat}, {$allergyStat}, '{$allergyText}',\n\t{$caseType}, '{$ptDOB}', '{$rptVerName}', '{$rptrVerDesig}',\n\t'{$chInitial}', {$chAge}, {$chAgeUnit}, {$chAgeGrp}, '{$chSex}',\n\t{$primRptrQuali}, '{$primRptrName}', '{$primRptrDesig}', '{$primRptrState}', '{$primRptrOrg}', '{$primRptrDept}', '{$primRptrAddrs}',\n\t'{$initRptNum}')"; // $log = " $query ".time().PHP_EOL; // file_put_contents('log.txt', $log, FILE_APPEND); $res = mysqli_query($con, $query); if ($res) { // echo "Form Submitted";
<?php include 'connection_pure.php'; include 'function.php'; $sql = "SELECT PR_ID, PR_STID, PR_NAME, PR_ADDRS, PR_STATUS FROM prem"; $res = mysqli_query($con, $sql); if ($res) { $dataArray = array(); if (mysqli_num_rows($res) > 0) { $tempArr = array(); while ($resRow = mysqli_fetch_array($res)) { $status = $resRow['PR_STATUS']; if ($status == 1) { $status = "Active"; } else { if ($status == 0) { $status = "Inactive"; } } $state = getStateNameByID($resRow['PR_STID']); $tempArr = array("PR_ID" => $resRow['PR_ID'], "PR_STID" => $state, "PR_NAME" => $resRow['PR_NAME'], "PR_ADDRS" => $resRow['PR_ADDRS'], "PR_STATUS" => $status); array_push($dataArray, $tempArr); } } } echo json_encode($dataArray);