mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Check query return value in search_results_page()
Instead of unconditionally calling fetch on the return value of query(), error out early if the value evaluates to false. Also, make sure that the results array is always initialized, even if the result set is empty. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
5553d01ab3
commit
6090c2ae8b
1 changed files with 5 additions and 2 deletions
|
@ -495,8 +495,11 @@ function search_results_page($O=0,$SB="",$U="",$T="",
|
|||
|
||||
$result = $dbh->query($q);
|
||||
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$userinfo[] = $row;
|
||||
$userinfo = array();
|
||||
if ($result) {
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$userinfo[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
include("account_search_results.php");
|
||||
|
|
Loading…
Add table
Reference in a new issue