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>
This commit is contained in:
canyonknight 2012-05-23 15:27:53 -04:00 committed by Lukas Fleischer
parent 71f2efd7af
commit 84d21e6f30
2 changed files with 8 additions and 4 deletions

View file

@ -602,6 +602,11 @@ function pkg_search_page($SID="", $dbh=NULL) {
} }
include('pkg_search_form.php'); include('pkg_search_form.php');
while ($row = mysql_fetch_assoc($result)) {
$searchresults[] = $row;
}
include('pkg_search_results.php'); include('pkg_search_results.php');
return; return;

View file

@ -46,9 +46,8 @@ if (!$result): ?>
</thead> </thead>
<tbody> <tbody>
<?php while (list($indx, $row) = each($searchresults)): ?>
<?php for ($i = 0; $row = mysql_fetch_assoc($result); $i++): ?> <tr class="<?php echo ($indx % 2 == 0) ? 'odd' : 'even' ?>">
<tr class="<?php echo ($i % 2 == 0) ? 'odd' : 'even' ?>">
<?php if ($SID): ?> <?php if ($SID): ?>
<td><input type="checkbox" name="IDs[<?php echo $row["ID"] ?>]" value="1" /></td> <td><input type="checkbox" name="IDs[<?php echo $row["ID"] ?>]" value="1" /></td>
<?php endif; ?> <?php endif; ?>
@ -76,7 +75,7 @@ if (!$result): ?>
<?php endif; ?> <?php endif; ?>
</td> </td>
</tr> </tr>
<?php endfor; ?> <?php endwhile; ?>
</tbody> </tbody>
</table> </table>