ok
Direktori : /proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/data-tables/ |
Current File : //proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/data-tables/mock_test-data-table.php |
<?php ob_start(); session_start(); include"../config/config.php"; // $allPermissions=$_SESSION['permission']; $requestData= $_REQUEST; /*Fetch Database column Details*/ $columns = array( 0 =>'id', 1 =>'home_type', 2 =>'id', 3 =>'home_news_content', 4 =>'id' ); $conditions=""; $filter_mock = $_POST['filter_mock']; error_log($filter_mock); if(!empty($filter_mock)){ $conditions.=" and h.mock_test_type ='$filter_mock'"; } /*Fetch All Data Start*/ $statement = $pdo->prepare("SELECT h.* FROM `tbl_mock_test` h where id!=0 ".$conditions." ORDER BY h.`id` ASC"); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $totalFiltered = $totalData; /*Fetch All Data End*/ /*Fetch Filter Data Start*/ $sql="SELECT h.* FROM tbl_mock_test h where h.id!=0".$conditions; if( !empty($_REQUEST['search']) ) { $sql.=" AND ( h. id LIKE '%".$_REQUEST['search']."%') "; } /*Fetch Filter Data End*/ $sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; $statement = $pdo->prepare($sql); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $data = array(); $i=1; foreach( $query as $row ) { // preparing an array $nestedData=array(); $nestedData[] = "<div class='text-center'><div class='btn-group'> <a style='padding: 6px;margin-right: 3px;' href='about-edit.php?id=".$row["id"]."' title='Edit Description' class='tip btn btn-warning btn-xs'> <i class='fa fa-edit'></i> </a> <button style='padding: 6px;margin-right: 3px;' value='11' title='Delete Course' onClick='delete_question(".$row["id"].")' class='tip btn btn-danger btn-xs'> <i class='fa fa-trash-o'></i> </button> </div></div>"; $nestedData[] = $i; if($row['exam_type']==1){ $exam_type="TNPSC GROUP 1"; }elseif($row['exam_type']==2){ $exam_type="TNPSC GROUP 2A"; }else{ $exam_type="TNPSC GROUP 4 VAO"; } if($row['mock_test_type']==1){ $mock_test_type="Mock Test Type 1"; }elseif($row['mock_test_type']==2){ $mock_test_type="Mock Test Type 2"; }else{ $mock_test_type="Mock Test Type 3"; } $nestedData[] = $exam_type; $nestedData[] = $mock_test_type; $nestedData[] = $row['question']; $nestedData[] = $row['option_a']; $nestedData[] = $row['option_b']; $nestedData[] = $row['option_c']; $nestedData[] = $row['option_d']; $nestedData[] = $row['explanation']; $nestedData[] = $row['correct_answer']; $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval( $requestData['draw'] ), "recordsTotal" => intval( $totalData ), "recordsFiltered" => intval( $totalFiltered ), "data" => $data ); echo json_encode($json_data); ?>