ok
Direktori : /proc/self/root/home2/selectio/www/vijay-gases/data-tables/ |
Current File : //proc/self/root/home2/selectio/www/vijay-gases/data-tables/users-data-table.php |
<?php ob_start(); session_start(); include"../config/config.php"; $requestData= $_REQUEST; /*Fetch Database column Details*/ $columns = array( 0 =>'id', 1 =>'username', 2 =>'password', 3 =>'status', 4 =>'created_at' ); $conditions=""; /*Fetch All Data Start*/ $statement = $pdo->prepare("SELECT * FROM tbl_user e where 1=1 and e.status=1 ".$conditions." ORDER BY e.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 * FROM tbl_user e where 1=1 and e.status=1 ".$conditions; if( !empty($_REQUEST['search']) ) { $sql.=" AND ( e.created_at 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(); $action= "<div class='text-center'><div class='btn-group'>"; /*$action.=" <a style='padding: 6px;margin-right: 3px;' href='modal/users-view.php?id=".$row["id"]."' data-toggle='ajax-modal' title='Update Trip Rate' class='tip btn btn-primary btn-xs'> <i class='fa fa-eye'></i> </a>";*/ $action.="<a style='padding: 6px;margin-right: 3px;' href='users-edit.php?id=".$row["id"]."' title='Edit Users' class='tip btn btn-warning btn-xs'> <i class='fa fa-edit'></i> </a> "; $action.=" <button style='padding: 6px;margin-right: 3px;' value='11' title='Delete Users' onClick='delete_users(".$row["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["username"]; $nestedData[] = $row["password"]; if($row["status"]==1){ $nestedData[] ="<span class='btn btn-success btn-xs'><i class='fa fa-eye'></i> Active</span>";}else{$nestedData[] ="<span onClick='dynamic_active(".$row["id"].")' class='btn btn-danger btn-xs'><i class='fa fa-eye-slash'> In-active</span>";} if($row["created_at"]!=""){ $nestedData[] =date('d-m-Y', strtotime($row["created_at"]));}else{$nestedData[] ="";} $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval( $requestData['draw'] ), "recordsTotal" => intval( $totalData ), "recordsFiltered" => intval( $totalFiltered ), "data" => $data ); echo json_encode($json_data); ?>