<?php include_once("dbconn.php"); if(isset($_POST["getdata"])) { $fdate=$_POST['fromdate']; $tdate=$_POST['todate']; $clinicbranch=$_POST['clinicbranch']; $newfollow=$_POST['newfollow']; $sqlQuery = "select * from patient where billdate between '$fdate' and '$tdate' AND (clinicbranch='$clinicbranch' OR newfollow='$newfollow')"; $resultSet = mysqli_query($conn, $sqlQuery) or die("database error:". mysqli_error($conn)); $patientData = array(); while( $patient = mysqli_fetch_assoc($resultSet) ) { $patientData[] = $patient; } $fileName = "spanclinic_export_".date('Ymd') . ".xls"; header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=\"$fileName\""); $showColoumn = false; if(!empty($patientData)) { foreach($patientData as $patientInfo) { if(!$showColoumn) { echo implode("\t", array_keys($patientInfo)) . "\n"; $showColoumn = true; } echo implode("\t", array_values($patientInfo)) . "\n"; } } exit; } ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)