From 905672243b75e6b3d367d439bdbbb37d1b5ae0fa Mon Sep 17 00:00:00 2001 From: Miguel Ribeiro Date: Mon, 2 Sep 2024 00:10:26 +0200 Subject: [PATCH] fix: warning on top of dashboard page (#512) --- includes/version.php | 2 +- index.php | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/version.php b/includes/version.php index e9eefaebb..4521a86bf 100644 --- a/includes/version.php +++ b/includes/version.php @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/index.php b/index.php index deaf97f16..3e12d7e64 100644 --- a/index.php +++ b/index.php @@ -14,6 +14,8 @@ $sql = "SELECT * FROM subscriptions WHERE user_id = :userId ORDER BY next_payment ASC, inactive ASC"; } +$params = array(); + if (isset($_COOKIE['sortOrder']) && $_COOKIE['sortOrder'] != "") { $sort = $_COOKIE['sortOrder'] ?? 'next_payment'; $sortOrder = $sort; @@ -28,7 +30,6 @@ $sort = "next_payment"; } - $params = array(); $sql = "SELECT * FROM subscriptions WHERE user_id = :userId"; if (isset($_GET['member'])) { @@ -105,8 +106,10 @@ $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER); -foreach ($params as $key => $value) { - $stmt->bindValue($key, $value, SQLITE3_INTEGER); +if (!empty($params)) { + foreach ($params as $key => $value) { + $stmt->bindValue($key, $value, SQLITE3_INTEGER); + } } $result = $stmt->execute();