ok
Direktori : /home2/selectio/www/thedentalpark.com/admin/data-tables/ |
Current File : /home2/selectio/www/thedentalpark.com/admin/data-tables/doctor_list.php |
<?php include"../config/config.php"; $requestData = $_REQUEST; $columns = array( 0 =>'id', 1 =>'id', 2 =>'id', 3 =>'id', 4 =>'id', 5 =>'id', 6 =>'id', 7 =>'id', 8 =>'id', 9 =>'id' ); $conditions=""; $doctor_name = $_POST['doctor_name']; $doctor_phone = $_POST['doctor_phone']; if($doctor_name!=""){ $conditions.=" and doctor_name="."'$doctor_name'" ; } if($doctor_phone!=""){ $conditions.=" and doctor_phone=".$doctor_phone ; } // print_r($conditions); die; $sql_query = "SELECT * from tbl_doctor"; /*Fetch All Data Start*/ $statement = $pdo->prepare("$sql_query WHERE 1=1 ".$conditions." ORDER BY id asc"); $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 (doctor_name LIKE '%".$_REQUEST['search']."%' OR doctor_phone 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(); $action=''; $action.="<a href='doctor_add.php?id=".$row['id']."' class='btn btn-warning btn-xs mr-2'><i class='fa fa-backward'></i> Update Info</a>"; $nestedData[] = "<div class='text-center'>".$i."</div>"; $nestedData[] = "<div class='text-center'>".$action."</div>"; $nestedData[] = "<div class='text-center'>".$row["doctor_name"]."</div>"; $nestedData[] = "<div class='text-center'>".$row["doctor_phone"]."</div>"; $nestedData[] = "<div class='text-center'>".$row['doctor_degree']."</div>"; $nestedData[] = "<div class='text-center'>".$row['doctor_address']."</div>"; $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval($requestData['draw']), "recordsTotal" => intval($totalData), "recordsFiltered" => intval($totalFiltered), "data" => $data ); echo json_encode($json_data); ?>