cvs: php-bugs-web / search.php
| From: | jim winstead | Date: | Mon, 29 Apr 2002 21:26:58 +0000 |
| Subject: | cvs: php-bugs-web / search.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-9950@lists.php.net to get a copy of this message | ||
jimw Mon Apr 29 17:26:58 2002 EDT
Modified files:
/php-bugs-web search.php
Log:
we're running on mysql 4 now, so we can use SQL_CALC_FOUND_ROWS. tested to be about 70%
faster on a search for open bugs using the string 'mysql'.
Index: php-bugs-web/search.php
diff -u php-bugs-web/search.php:1.16 php-bugs-web/search.php:1.17
--- php-bugs-web/search.php:1.16 Sun Apr 21 13:58:03 2002
+++ php-bugs-web/search.php Mon Apr 29 17:26:58 2002
@@ -22,7 +22,8 @@
if (!$bug_type) $bug_type = "Any";
- $query = "SELECT *,TO_DAYS(NOW())-TO_DAYS(ts2) AS unchanged FROM bugdb ";
+ $query = "SELECT SQL_CALC_FOUND_ROWS *,"
+ . "TO_DAYS(NOW())-TO_DAYS(ts2) AS unchanged FROM bugdb ";
if($bug_type=="Any") {
$where_clause = "WHERE bug_type != 'Feature/Change Request'";
@@ -94,17 +95,15 @@
if($limit!='All') $query .= " LIMIT $begin,$limit";
- $res = @mysql_query("SELECT COUNT(*) FROM bugdb $where_clause");
+ $res = @mysql_query($query);
if (!$res) die(htmlspecialchars($query)."<br>".mysql_error());
- $row = mysql_fetch_row($res);
- $total_rows = $row[0];
+ $total_rows = mysql_get_one("SELECT FOUND_ROWS()");
+
if (!$total_rows) {
$errors[] = "No bugs with the specified criteria were found.";
}
else {
- $res = @mysql_query($query);
- if (!$res) die(htmlspecialchars($query)."<br>".mysql_error());
$rows = mysql_numrows($res);
$link = "$PHP_SELF?cmd=display&bug_type=" . urlencode ($bug_type) .
"&status=$status&search_for=".urlencode(htmlspecialchars(stripslashes($search_for)))."&php_os=".htmlspecialchars(stripslashes($php_os))."&bug_age=$bug_age&by=$by&order_by=$order_by&direction=$direction&phpver=$phpver&limit=$limit&assign=$assign";