ok
Direktori : /home2/selectio/www/thedentalpark.com/admin/data-tables/ |
Current File : /home2/selectio/www/thedentalpark.com/admin/data-tables/review_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=""; $reviewer_name = $_POST['reviewer_name']; $reviewer_email = $_POST['reviewer_email']; if($reviewer_name!=""){ $conditions.=" and reviewer_name="."'$reviewer_name'" ; } if($reviewer_email!=""){ $conditions.=" and reviewer_email=".$reviewer_email ; } // print_r($conditions); die; $sql_query = "SELECT * from tbl_review"; /*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 (reviewer_name LIKE '%".$_REQUEST['search']."%' OR reviewer_email 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='#?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["reviewer_name"]."</div>"; $nestedData[] = "<div class='text-center'>".$row["reviewer_email"]."</div>"; $nestedData[] = "<div class='text-center'>".$row['rating']."</div>"; $nestedData[] = "<div class='text-center'>".$row['message']."</div>"; $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval($requestData['draw']), "recordsTotal" => intval($totalData), "recordsFiltered" => intval($totalFiltered), "data" => $data ); echo json_encode($json_data); ?>