0 AND time_epoch BETWEEN $i AND $i_next"; if ( $i_next+1 <= $end ) { $sql = $sql." UNION "; } } $sql = "SELECT Date, count(gpu_number) FROM ( $sql ) subQuery GROUP BY Date"; $result =& db_query($db, $sql); $columns = array("Date", "Number of GPUs Used"); if ( isset($_POST['csv']) ) { $csvresult = db_query($db,$sql); result_as_csv($csvresult,$columns,$_POST['system']."-daily-used-gpu-".$_POST['start_date']."-".$_POST['end_date']); } if ( isset($_POST['xls']) ) { $xlsresult = db_query($db,$sql); result_as_xls($xlsresult,$columns,$_POST['system']."-daily-used-gpu-".$_POST['start_date']."-".$_POST['end_date']); } if ( isset($_POST['ods']) ) { $odsresult = db_query($db,$sql); result_as_ods($odsresult,$columns,$_POST['system']."-daily-used-gpu-".$_POST['start_date']."-".$_POST['end_date']); } db_disconnect($db); //bookmarkable_url(); } else { begin_form("gpu-report-daily-used-gpu.php"); system_chooser(); date_fields(); ## This will handle exporting.... checkbox("Generate CSV files for supplemental reports","csv"); checkbox("Generate Excel files for supplemental reports","xls"); checkbox("Generate ODF files for supplemental reports","ods"); end_form(); } page_footer(); ?>