From 68d2578eb850ab834970f0e818f8ffab37688af1 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 25 Jul 2015 17:44:56 -0600 Subject: [PATCH] Simplify adding items to the domains array. --- resources/pdo.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/resources/pdo.php b/resources/pdo.php index c9ba60fa0b..0c63ca94d3 100644 --- a/resources/pdo.php +++ b/resources/pdo.php @@ -241,12 +241,11 @@ if ($db_type == "pgsql") { $prep_statement = $db->prepare($sql); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - if (count($result) > 0) { - foreach($result as $row) { - $domain_names[] = $row['domain_name']; - } + foreach($result as $row) { + $domain_names[] = $row['domain_name']; } unset($prep_statement); + //put the domains in natural order natsort($domain_names); //build the domains array in the correct order @@ -270,9 +269,7 @@ if ($db_type == "pgsql") { $_SESSION["domain_name"] = $row["domain_name"]; } } - $_SESSION['domains'][$row['domain_uuid']]['domain_uuid'] = $row['domain_uuid']; - $_SESSION['domains'][$row['domain_uuid']]['domain_name'] = $row['domain_name']; - $_SESSION['domains'][$row['domain_uuid']]['domain_description'] = $row['domain_description']; + $_SESSION['domains'][$row['domain_uuid']] = $row; } unset($domains, $prep_statement); } @@ -336,4 +333,4 @@ if ($db_type == "pgsql") { } } -?> \ No newline at end of file +?>