prepare("SELECT COUNT(*) FROM detections WHERE Date == \"$theDate\""); $result1 = $statement1->execute(); $totalcount = $result1->fetchArray(SQLITE3_ASSOC); if(isset($_GET['blocation']) ) { header("Content-type: text/csv"); header("Content-Disposition: attachment; filename=result_file.csv"); header("Pragma: no-cache"); header("Expires: 0"); $user = trim(shell_exec("awk -F: '/1000/{print $1}' /etc/passwd")); $home = trim(shell_exec("awk -F: '/1000/{print $6}' /etc/passwd")); $list = array ( array('', '', $_GET['blocation']), array('Latitude', '', $config["LATITUDE"]), array('Longitude', '', $config["LONGITUDE"]), array('Date', '', date("m/d/Y", strtotime($theDate))), array('Start Time', '', '0:00'), array('State', '', $_GET['state']), array('Country', '', $_GET['country']), array('Protocol', '', $_GET['protocol']), array('Num Observers', '', $_GET['num_observers']), array('Duration (min)', '', '1440'), array('All Obs Reported (Y/N)', '', 'Y'), array('Dist Traveled (Miles)', '', $_GET['dist_traveled']), array('Area Covered (Acres)', '', ''), array('Notes', '', $_GET['notes']) ); $statement1 = $db->prepare("SELECT DISTINCT(Com_Name), COUNT(*) FROM detections WHERE Date == \"$theDate\" GROUP By Com_Name ORDER BY COUNT(*) DESC"); if($statement1 == False){ echo "Database is busy"; header("refresh: 0;"); } $result1 = $statement1->execute(); $detections = []; while($detection=$result1->fetchArray(SQLITE3_ASSOC)) { $detections[$detection["Com_Name"]] = $detection["COUNT(*)"]; } foreach($detections as $com_name=>$scount) { array_push($list, array($com_name,'',$scount)); } $output = fopen("php://output", "w"); foreach ($list as $row) { fputcsv($output, $row); } fclose($output); die(); } ?>
| Total Detections For The Day |
|---|
No Charts for $theDate
"; } echo "No Charts For $theDate
"; }?>