%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php
include("secure/db_config.php");
$department = $_GET['department'];
$startdate = $_GET['startdate'];
$enddate = $_GET['enddate'];
if(!empty($department) and ($department!='All')) {
$query = mysqli_query($connection,"SELECT * FROM `tbl_lms_reg` where department='".$department."' ORDER BY id DESC");
} if($department=='All') {
$query = mysqli_query($connection,"SELECT * FROM `tbl_lms_reg` ORDER BY id DESC");
}
if((!empty($startdate)) and (!empty($enddate))){
$KEYWORD_SEARCH_6="and c_date BETWEEN '".$startdate." "."00:00:00"."' and '".$enddate." "."23:59:59"."' ";
$query = mysqli_query($connection,"select * from `tbl_lms_reg` WHERE 1 $KEYWORD_SEARCH_6 order by id DESC") or die(mysqli_error());
}
else {
$query = mysqli_query($connection,"SELECT * FROM `tbl_lms_reg` ORDER BY id DESC");
}
$numbs = mysqli_num_rows($query);
if($numbs > 0){
$delimiter = ",";
$filename = "Sharda_Hospital_LMS" . date('Y-m-d') . ".csv";
$f = fopen('php://memory', 'w');
//set column headers
$fields = array("Name","Email","PhoneNo","Department","Appointment","Additional-Info","Create-Date","Landing Page","utm_source","utm_campaign","utm_medium","utm_term","utm_content","utm_keyword","utm_placement");
fputcsv($f, $fields, $delimiter);
//output each row of the data, format line as csv and write to file pointer
while($row = mysqli_fetch_assoc($query)){
$lineData = array($row['full_name'], $row['email'], $row['phone_no'],$row['department'], $row['date_time'], $row['additional_info'],$row['c_date'],$row['landing_page'],$row['utm_source'],$row['utm_campaign'], $row['utm_medium'],$row['utm_term'],$row['utm_content'],$row['utm_keyword'],$row['utm_placement']);
fputcsv($f, $lineData, $delimiter);
}
fseek($f, 0);
//set headers to download file rather than displayed
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="' . $filename . '";');
//output all remaining data on a file pointer
fpassthru($f);
}
exit;
?>