From 466adc7ea5c2199b162dda2a0a7cd64203e0735e Mon Sep 17 00:00:00 2001 From: Michiel Dethmers Date: Sun, 17 Oct 2021 17:03:44 +0100 Subject: [PATCH] check on var --- pages/home.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pages/home.php b/pages/home.php index e919b66..29e3c45 100644 --- a/pages/home.php +++ b/pages/home.php @@ -38,15 +38,17 @@ )); if ($result) { $row = Sql_Fetch_Assoc($result); - $lastCampaignID = $row['id']; - $lastcampaign = Sql_Fetch_Assoc_Query(sprintf( - 'select msg.id as messageid,count(um.viewed) as views, count(um.status) as total, - subject,date_format(sent,"%%e %%M %%Y") as sent,bouncecount as bounced - from %s um - join %s msg on msg.id = um.messageid - where msg.id = %d and um.status = "sent"', - $GLOBALS['tables']['usermessage'], $GLOBALS['tables']['message'], $lastCampaignID - )); + if (!empty($row['id'])) { + $lastCampaignID = $row['id']; + $lastcampaign = Sql_Fetch_Assoc_Query(sprintf( + 'select msg.id as messageid,count(um.viewed) as views, count(um.status) as total, + subject,date_format(sent,"%%e %%M %%Y") as sent,bouncecount as bounced + from %s um + join %s msg on msg.id = um.messageid + where msg.id = %d and um.status = "sent"', + $GLOBALS['tables']['usermessage'], $GLOBALS['tables']['message'], $lastCampaignID + )); + } } } else { $result = Sql_Query(sprintf(