} $db->query("SELECT COUNT(*) as total from " . $db->qi("SupportTickets") . " where " . $query); $db->next_record(); if ($db->f("total") < $q_SupportTickets->start_row - $q_SupportTickets->row_count) { $q_SupportTickets->start_row = $db->f("total") - $q_SupportTickets->row_count; } if ($q_SupportTickets->start_row < 0) { $q_SupportTickets->start_row = 0; } $query .= " LIMIT " . $q_SupportTickets->start_row . "," . $q_SupportTickets->row_count; // In any case we must display that form now. Note that the // "x" here and in the call to $q->where must match. // Tag everything as a CSS "query" class. echo "<a href=javascript:show('customQuery')>Custom Query</a>"; echo "\n<div id=customQuery {$hideQuery}><a href=javascript:hide('customQuery')>Hide</a>\n"; printf($q_SupportTickets->form("x", $t->map_cols, "query")); echo "\n</div>\n"; // Do we have a valid query string? if ($query) { // Show that condition echo "<a href=javascript:show('QueryStats')>Query Stats</a><div id=QueryStats style=display:none>"; echo "<a href=javascript:hide('QueryStats')>Hide</a><br>"; printf("Query Condition = %s<br />\n", $query); // Do that query $sql = $t->select($f) . $query; $db->query($sql); // Dump the results (tagged as CSS class default) printf("Query Results = %s<br /></div>\n", $db->num_rows()); echo "<br />"; $t->show_result($db, "default"); }