cvs: pearweb /public_html package-search.php
| From: | Martin Jansen | Date: | Wed, 23 Jan 2002 21:33:24 +0000 |
| Subject: | cvs: pearweb /public_html package-search.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-2068@lists.php.net to get a copy of this message | ||
mj Wed Jan 23 16:33:24 2002 EDT
Modified files:
/pearweb/public_html package-search.php
Log:
* Allow searching for specific category.
Index: pearweb/public_html/package-search.php
diff -u pearweb/public_html/package-search.php:1.3 pearweb/public_html/package-search.php:1.4
--- pearweb/public_html/package-search.php:1.3 Wed Jan 23 16:11:09 2002
+++ pearweb/public_html/package-search.php Wed Jan 23 16:33:22 2002
@@ -38,6 +38,11 @@
$where[] = "handle like
'%".addslashes($_GET['pkg_maintainer'])."%'";
}
+ // Build category part of query
+ if(!empty($_GET['pkg_category'])) {
+ $where[] = "category =
'".addslashes($_GET['pkg_category'])."'";
+ }
+
// Compose query and execute
$where = !empty($where) ? ' AND '.implode(' AND ', $where) : '';
$sql = "select p.id, p.name, p.category, p.summary, m.handle from packages p, maintains
m where p.id = m.package " . $where . " order by p.name";
@@ -81,6 +86,24 @@
<tr>
<td>Maintainer:</td>
<td><input type="text" name="pkg_maintainer"
value="<?=$_GET['pkg_maintainer']?>"></td>
+ </tr>
+ <tr>
+ <td>Category:</td>
+ <td><select name="pkg_category" size="1">
+ <option value=""></option>
+<?php
+$sth = $dbh->query('SELECT id, name FROM categories ORDER BY name');
+
+while ($row = $sth->fetchRow(DB_FETCHMODE_ASSOC)) {
+ if (isset($_GET['pkg_category']) && $_GET['pkg_category'] ==
$row['id']) {
+ echo "<option value=\"" . $row['id'] . "\"
selected>" . $row['name'] . "</option>\n";
+ } else {
+ echo "<option value=\"" . $row['id'] . "\">"
. $row['name'] . "</option>\n";
+ }
+}
+?>
+ </select>
+ </td>
</tr>
<tr>