cvs: php-bugs-web / search.php
| From: | Wez Furlong | Date: | Sun, 19 Jan 2003 12:13:33 +0000 |
| Subject: | cvs: php-bugs-web / search.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-15177@lists.php.net to get a copy of this message | ||
wez Sun Jan 19 07:13:33 2003 EDT
Modified files:
/php-bugs-web search.php
Log:
Use GET as the method so that Harald can bookmark his searches easily.
Also add a version check for the mysql server, so that the script can fall
back on "guessing" the number of matched rows when run against a server
whose version is less than 4.0.0.
Index: php-bugs-web/search.php
diff -u php-bugs-web/search.php:1.34 php-bugs-web/search.php:1.35
--- php-bugs-web/search.php:1.34 Sun Oct 27 06:49:52 2002
+++ php-bugs-web/search.php Sun Jan 19 07:13:33 2003
@@ -21,10 +21,16 @@
or die("Unable to connect to SQL server.");
@mysql_select_db("php3");
+ $mysql4 = version_compare(mysql_get_server_info(), "4.0.0", "ge");
+
if (!$bug_type) $bug_type = "Any";
- $query = "SELECT SQL_CALC_FOUND_ROWS *,"
- . "TO_DAYS(NOW())-TO_DAYS(ts2) AS unchanged FROM bugdb ";
+ if ($mysql4)
+ $query = "SELECT SQL_CALC_FOUND_ROWS ";
+ else
+ $query = "SELECT ";
+
+ $query .= "*, TO_DAYS(NOW())-TO_DAYS(ts2) AS unchanged FROM bugdb ";
if($bug_type=="Any") {
$where_clause = "WHERE bug_type != 'Feature/Change Request'";
@@ -110,9 +116,13 @@
$res = @mysql_query($query);
if (!$res) die(htmlspecialchars($query)."<br>".mysql_error());
- $total_rows = mysql_get_one("SELECT FOUND_ROWS()");
-
$rows = mysql_num_rows($res);
+
+ if ($mysql4)
+ $total_rows = mysql_get_one("SELECT FOUND_ROWS()");
+ else /* lame mysql 3 compatible attempt to allow browsing the search */
+ $total_rows = $rows < 10 ? $rows : $begin + $rows + 10;
+
if (!$rows) {
$errors[] = "No bugs with the specified criteria were found.";
}
@@ -173,7 +183,7 @@
if ($errors) display_errors($errors);
if ($warnings) display_warnings($warnings);
?>
-<form id="asearch" method="post" action="<?php echo
$PHP_SELF?>">
+<form id="asearch" method="get" action="<?php echo
$PHP_SELF?>">
<table id="primary" width="95%">
<tr>
<th>Find bugs</th>