ok

Mini Shell

Direktori : /home2/selectio/www/lilyexpresslive/software/admin/data-tables/
Upload File :
Current File : /home2/selectio/www/lilyexpresslive/software/admin/data-tables/error-log-data-table.php

<?php
include("../inc/config.php");
ini_set('memory_limit', '1024M');
    $from = $_REQUEST['from'];
    $to = $_REQUEST['to'];
    

$requestData= $_REQUEST;
/*Fetch Database column Details*/
        $columns = array( 
            0 =>'id', 
            1 =>'type',
            2 =>'text',
            3 =>'created_at',
        );
        
/*Fetch All Data Start*/        
          $condition='where 1=1 ';
          
        
        if($from!='' && $to!='')
        {
                $condition.=" and created_at BETWEEN '$from' AND '$to' ";
        }
/*Fetch All Data Start*/        
          
        $statement = $pdo->prepare("SELECT * from error_log_report $condition");

		$statement->execute();
		$query = $statement->fetchAll(PDO::FETCH_ASSOC);
		$totalData = $statement->rowCount();
        $totalFiltered = $totalData;
/*Fetch All Data End*/       
        
/*Fetch Filter Data Start*/    
    	 
    	
        $sql="SELECT * from error_log_report $condition";   
          
         if( !empty($requestData['search']['value']) ) 
        {   
        	$sql.=" AND ( type LIKE '%".$requestData['search']['value']."%' ";    
        	$sql.=" OR text LIKE '%".$requestData['search']['value']."%' )";
        }

    	$statement = $pdo->prepare($sql);

        $statement->execute();
		$query = $statement->fetchAll(PDO::FETCH_ASSOC);
        $totalFiltered = $statement->rowCount();
        
/*Fetch Filter Data End*/       
        


 $sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]."   ".$requestData['order'][0]['dir']."  LIMIT ".$requestData['start']." ,".$requestData['length']."   ";
//  $requestData['order'][0]['column'] contains colmun index, $requestData['order'][0]['dir'] contains order such as asc/desc  */	
$statement = $pdo->prepare($sql);
        $statement->execute();
		$query = $statement->fetchAll(PDO::FETCH_ASSOC);

$data = array();
$i=$requestData['start']+1;
foreach( $query as $row ) {  // preparing an array
                        $nestedData=array(); 
                     	$nestedData[] = $i;
                     	$nestedData[] = "<input type='checkbox' class='checkbox' name='checkboxlist' value='".$row['id']."'/>";
                      	$nestedData[] = $row["type"];
                      	$nestedData[] = $row["text"];
                      	$created=date_create($row['created_at']);
                            $da=date_format($created,'d-m-Y h:i:s A');
                      	$nestedData[] = $da;
                    	
                    	$data[] = $nestedData;
                    	$i++;
                    	
                    	$statement = $pdo->prepare("UPDATE error_log_report SET status=? WHERE id=?");
    	                $statement->execute(array(0,$row['id']));
                    }



$json_data = array(
			"draw"            => intval( $requestData['draw'] ),   // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw. 
			"recordsTotal"    => intval( $totalData ),  // total number of records
			"recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
			"data"            => $data   // total data array
			);

echo json_encode($json_data);  // send data as json format

?>


Zerion Mini Shell 1.0