account_search_results.php: Pull out DB code

* Move DB code from account_search_results.php to already existing function
in acctfuncs.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>
This commit is contained in:
canyonknight 2012-05-23 15:25:23 -04:00 committed by Lukas Fleischer
parent c2b65f2b7b
commit 71f2efd7af
2 changed files with 7 additions and 2 deletions

View file

@ -323,6 +323,12 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="",
$dbh = db_connect(); $dbh = db_connect();
$result = db_query($q, $dbh); $result = db_query($q, $dbh);
$num_rows = mysql_num_rows($result);
while ($row = mysql_fetch_assoc($result)) {
$userinfo[] = $row;
}
include("account_search_results.php"); include("account_search_results.php");
return; return;
} }

View file

@ -2,7 +2,6 @@
if (!$result): if (!$result):
print __("No results matched your search criteria."); print __("No results matched your search criteria.");
else: else:
$num_rows = mysql_num_rows($result);
if ($num_rows): if ($num_rows):
?> ?>
<table class="results"> <table class="results">
@ -20,7 +19,7 @@ else:
</thead> </thead>
<?php <?php
$i = 0; $i = 0;
while ($row = mysql_fetch_assoc($result)): while (list($indx, $row) = each($userinfo)):
if ($i % 2): if ($i % 2):
$c = "even"; $c = "even";
else: else: