ok
Direktori : /home2/selectio/public_html/tnpsctestbatch.com/admin/data-tables/ |
Current File : /home2/selectio/public_html/tnpsctestbatch.com/admin/data-tables/user-data-table.php |
<?php ob_start(); session_start(); include"../config/config.php"; $requestData= $_REQUEST; /*Fetch Database column Details*/ $columns = array( 0 =>'id', 1 =>'home_type', 2 =>'id', 3 =>'home_news_content', 4 =>'id', 5 =>'id', 6 =>'id' ); $conditions=""; /*Fetch All Data Start*/ // $statement = $pdo->prepare("SELECT * FROM `tbl_standard` ORDER BY `standard` DESC"); error_log("SELECT * FROM tbl_students WHERE 1=1 $conditions ORDER BY id DESC"); $statement = $pdo->prepare("SELECT * FROM tbl_students WHERE 1=1 $conditions ORDER BY 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_students WHERE 1=1 $conditions"; if( !empty($_REQUEST['search']) ) { $sql.=" AND (id 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'> <a style='padding: 6px;margin-right: 3px;' href='#' title='Edit User' class='tip btn btn-warning btn-xs'> <i class='fa fa-edit'></i> </a> <button style='padding: 6px;margin-right: 3px;' value='11' title='Delete User' onClick='delete_User(".$row["id"].")' class='tip btn btn-danger btn-xs'> <i class='fa fa-trash-o'></i> </button> </div></div>"; $nestedData[] = $i; $nestedData[] = $action; $nestedData[] = $row['name']; $nestedData[] = $row['dob']; $nestedData[] = $row['email']; $nestedData[] = $row['mobile_no']; $nestedData[] = $row['password']; $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval( $requestData['draw'] ), "recordsTotal" => intval( $totalData ), "recordsFiltered" => intval( $totalFiltered ), "data" => $data ); echo json_encode($json_data); ?>