diff options
author | canyonknight <canyonknight@gmail.com> | 2012-05-23 15:27:53 -0400 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2012-07-06 11:26:56 +0200 |
commit | 84d21e6f30a2f0219f27942998d295d716751bf6 (patch) | |
tree | 0ba01d4174c5a5867acfd6aa98392d6c252d08ac /web | |
parent | 71f2efd7af4b32eb514c134769fc969e5e64bd2b (diff) | |
download | aurweb-84d21e6f30a2f0219f27942998d295d716751bf6.tar.xz |
pkg_search_results.php: Pull out DB code
* Move DB code from pkg_search_results.php to already existing function
in pkgfuncs.inc.php
* Centralization of DB code important in a future transition to PDO interface
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web')
-rw-r--r-- | web/lib/pkgfuncs.inc.php | 5 | ||||
-rw-r--r-- | web/template/pkg_search_results.php | 7 |
2 files changed, 8 insertions, 4 deletions
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index 2265c76..979d74b 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -602,6 +602,11 @@ function pkg_search_page($SID="", $dbh=NULL) { } include('pkg_search_form.php'); + + while ($row = mysql_fetch_assoc($result)) { + $searchresults[] = $row; + } + include('pkg_search_results.php'); return; diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index 95590f7..d676c0a 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -46,9 +46,8 @@ if (!$result): ?> </thead> <tbody> - - <?php for ($i = 0; $row = mysql_fetch_assoc($result); $i++): ?> - <tr class="<?php echo ($i % 2 == 0) ? 'odd' : 'even' ?>"> + <?php while (list($indx, $row) = each($searchresults)): ?> + <tr class="<?php echo ($indx % 2 == 0) ? 'odd' : 'even' ?>"> <?php if ($SID): ?> <td><input type="checkbox" name="IDs[<?php echo $row["ID"] ?>]" value="1" /></td> <?php endif; ?> @@ -76,7 +75,7 @@ if (!$result): ?> <?php endif; ?> </td> </tr> - <?php endfor; ?> + <?php endwhile; ?> </tbody> </table> |