Edit file File name : export-qpass-cron-log.php Content :<?php include("../include/config.php"); include("../include/functions.php"); if($_REQUEST['exportExcel']=='yes'){ $where=''; if($_REQUEST['search_from_date']!='' && $_REQUEST['search_to_date']!=''){ $where.=" and Date(start_datetime)>='".$_REQUEST['search_from_date']."' and Date(start_datetime)<='".$_REQUEST['search_to_date']."' "; } $order_by='id'; $order_by2=' desc '; $sql=$obj->Query("SELECT * from tbl_qpass_cron_log where 1=1 $where order by $order_by $order_by2",$debug=-1); $csvData=''; $csvData.="Start Datetime,End Datetime, Total Success, Total Failed, Failed Log"; $csvData.="\n"; $reccnt=$obj->numRows($sql); if($reccnt>0){ $count=1; while($data=$obj->fetchNextObject($sql)) { $falied_log=mysqli_real_escape_string($GLOBALS['conn'],$data->falied_log); $csvData.=stripslashes($data->start_datetime).","; $csvData.=stripslashes($data->end_datetime).","; $csvData.=stripslashes($data->total_success_payment).","; $csvData.=stripslashes($data->total_failed_payment).","; $csvData.=stripslashes($falied_log).","; $csvData.="\n"; $count++; } } header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/csv"); header("Content-Disposition: attachment; filename=qpass-cron-Report-".date("dMY_H:i").".csv"); echo $csvData; exit; header("location:".$_SERVER['HTTP_REFERER']); exit(); } ?> Save