ok
Direktori : /home2/selectio/www/saew.in/admin/data-tables/ |
Current File : /home2/selectio/www/saew.in/admin/data-tables/name-categpry-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 =>'image_name', 2 =>'id', 3 =>'id' ); $conditions=""; /*$department=$_REQUEST['department']; if(!empty($department)){ $conditions.=" and h.departement ='$department'"; }*/ /*Fetch All Data Start*/ error_log("SELECT h.*,h.id AS client_id,tbl_client_category.* FROM tbl_clientname h INNER JOIN tbl_client_category ON tbl_client_category.id = h.category_id WHERE h.id!=0 ".$conditions." ORDER BY h.id DESC"); $statement = $pdo->prepare("SELECT h.*,h.id AS client_id,tbl_client_category.* FROM tbl_clientname h INNER JOIN tbl_client_category ON tbl_client_category.id = h.category_id WHERE h.id!=0 ".$conditions." ORDER BY h.id DESC"); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $totalFiltered = $totalData; /*Fetch All Data End*/ /*Fetch Filter Data Start*/ $sql="SELECT h.*,h.id AS client_id,tbl_client_category.* FROM tbl_clientname h INNER JOIN tbl_client_category ON tbl_client_category.id = h.category_id WHERE h.id!=0 ".$conditions; if( !empty($_REQUEST['search']) ) { $sql.=" AND ( h.client_image LIKE '%".$_REQUEST['search']."%') "; } /*Fetch Filter Data End*/ $sql.=" ORDER BY h.". $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(); $action= "<div class='text-center'><div class='btn-group'>"; if($_SESSION['hrm']['id']==1 || $allPermissions['gallery']['update']=="1"){ $action.=" <a style='padding: 6px;margin-right: 3px;' href='name-edit.php?id=".$row["client_id"]."' title='Edit Gallery' class='tip btn btn-warning btn-xs'> <i class='fa fa-edit'></i> </a>"; } if($_SESSION['hrm']['id']==1 || $allPermissions['gallery']['delete']=="1"){ $action.='<button style="padding: 6px;margin-right: 3px;" title="Delete Client Details" onClick="delete_gallery('.$row["client_id"].')" class="tip btn btn-danger btn-xs"> <i class="fa fa-trash-o"></i> </button>'; } $action.="</div></div>"; $nestedData[] = $action; $nestedData[] = $i; $nestedData[] = $row['client_name']; $nestedData[] = $row['category_name']; $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval( $requestData['draw'] ), "recordsTotal" => intval( $totalData ), "recordsFiltered" => intval( $totalFiltered ), "data" => $data ); echo json_encode($json_data); ?>