//header("Content-Length: $filesize"); header("Content-Disposition-type: attachment"); header("Content-Disposition: attachment; filename={$reportname}"); } // displays multiple records in a report (last search statement) if ($_GET['tableview']) { // figure out the current query: $queryname = $tableinfo->short . '_query'; if (session_is_registered($queryname) && isset($_SESSION[$queryname])) { // get a list with all records we may see, create temp table tempb $listb = may_read_SQL($db, $tableinfo, $USER, 'tempb'); // read all fields in from the description file $fields_table = comma_array_SQL($db, $tableinfo->desname, columnname, ""); //$fields_table="id,".$fields_table; // prepare the search statement $query = make_search_SQL($db, $tableinfo, $fields_table, $USER, $search, $sortstring, $listb["sql"]); //$db->debug=true; $r = $db->Execute($query); //$db->debug=false; if ($reportid > 0) { echo $header; } elseif ($reportid == -1) { // xml echo "<phplabware_base>\n"; } elseif ($reportid == -2) { // tab headers $Allfields = getvalues($db, $tableinfo, $fields_table); echo make_sheet($db, $Allfields, $tableinfo, $USER['settings']['reportoutput'], $Fieldscomma, "\t", true); } elseif ($reportid == -3) { // comma headers $Allfields = getvalues($db, $tableinfo, $fields_table);
//$db->debug=false; // store sortdirarry in _SESSION using the appropriate table designation // need to do this after make_search_SQL $_SESSION[$fieldvarsname]['serialsortdirarray'] = serialize($sortdirarray); // when search fails we'll revert to Show All after showing an error message if (!$r) { echo "<h3 align='center'>The server encountered an error executing your search. Showing all records instead.</h3><br>\n"; $num_p_r = $_GET['num_p_r']; unset($_GET); ${$pagename} = 1; unset(${$queryname}); unset($_SESSION[$queryname]); unset($serialsortdirarray); unset($sortstring); //session_unregister($queryname); ${$queryname} = make_search_SQL($db, $tableinfo, $fields_table, $USER, $search, $sortstring, $listb['sql']); $r = $db->Execute(${$queryname}); if (!isset($r)) { echo "{${$queryname}}.<br>"; $db->debug = true; $r = $db->Execute(${$queryname}); $db->debug = false; } } // set variables needed for paging $numrows = $r->RecordCount(); // set the current page to what the user ordered ${$pagename} = current_page(${$pagename}, $tableinfo->short, $num_p_r, $numrows); // work around bug in adodb/mysql $r->Move(1); // set $rp->AtFirstPage and $rp->AtLastPage, will be used in nex-Previous buttons