ok
Direktori : /home2/selectio/www/thedentalpark.com/admin/data-tables/ |
Current File : /home2/selectio/www/thedentalpark.com/admin/data-tables/call_list.php |
<?php include"../config/config.php"; $requestData = $_REQUEST; $columns = array( 0 =>'date', 1 =>'time', 2 =>'id', 3 =>'id', 4 =>'id', 5 =>'id', 6 =>'id', 7 =>'id', 8 =>'id', 9 =>'id' ); $conditions=""; $patient_number1 = $_POST['patient_number1']; $patient_name = $_POST['patient_name']; if($patient_number1!=""){ $conditions.=" and patient_number1=".$patient_number1; } if($patient_name!=""){ $conditions.=" and patient_name="."'$patient_name'"; } $sql_query = "SELECT * from tbl_appointment_booking"; /*Fetch All Data Start*/ $statement = $pdo->prepare("$sql_query WHERE 1=1 ".$conditions." ORDER BY date DESC, time DESC"); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $totalFiltered = $totalData; /*Fetch All Data End*/ /*Fetch Filter Data Start*/ $sql = "$sql_query WHERE 1=1 ".$conditions; if( !empty($_REQUEST['search'])){ $sql.=" AND (patient_name LIKE '%".$_REQUEST['search']."%' OR patient_number1 LIKE '%".$_REQUEST['search']."%' OR patient_number2 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(); // error_log($sql); $i=1; foreach($query as $row){ $nestedData = array(); if($row['date'] != ""){ $dates=date('d-M-Y',strtotime($row['date'])); } else{ $dates=""; } $nestedData[] = "<div class='text-center'>".$i."</div>"; $nestedData[] = "<div class='text-center'>".$row["patient_name"]."</div>"; $nestedData[] = "<div class='text-center'>".$row["patient_number1"]."</div>"; $nestedData[] = "<div class='text-center'>".$dates."</div>"; $nestedData[] = "<div class='text-center'>".$row['time']."</div>"; $nestedData[] = "<div class='text-center'>".$row['status']."</div>"; $nestedData[] = "<div class='text-center'>".$row['reason']."</div>"; $nestedData[] = "<div class='text-center'>".$row['call_report']."</div>"; $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval($requestData['draw']), "recordsTotal" => intval($totalData), "recordsFiltered" => intval($totalFiltered), "data" => $data ); echo json_encode($json_data); ?>