diff --git a/DonationsStats.php b/DonationsStats.php
index 9da1770..ae04526 100755
--- a/DonationsStats.php
+++ b/DonationsStats.php
@@ -14,6 +14,11 @@ $total_ever = 0.0;
function print_donation_year($year) {
+if ($db_link == false) {
+ echo '
DB connection failed |
';
+ return;
+}
+
$amount = 0.0;
$max_month = 0.0;
@@ -21,22 +26,20 @@ $total_year = 0.0;
$donation_count = 0.0;
-if ($db_link) {
- $sql_donations = mysql_query("SELECT * FROM donations WHERE YEAR(dt) = " . $year);
-
- if (mysql_num_rows($sql_donations)) {
- while ($sql_row = mysql_fetch_assoc($sql_donations)) {
- $amount = $sql_row["amount"];
- $donation_count += 1.0;
- if ($amount > $max_month) {
- $max_month = $amount;
- if ($amount > $biggest_donation_value) {
- $biggest_donation_date = date("Y-m-d", strtotime($sql_row["dt"]));
- $biggest_donation_value = $amount;
- }
+$sql_donations = mysql_query("SELECT * FROM donations WHERE YEAR(dt) = " . $year);
+
+if (mysql_num_rows($sql_donations)) {
+ while ($sql_row = mysql_fetch_assoc($sql_donations)) {
+ $amount = $sql_row["amount"];
+ $donation_count += 1.0;
+ if ($amount > $max_month) {
+ $max_month = $amount;
+ if ($amount > $biggest_donation_value) {
+ $biggest_donation_date = date("Y-m-d", strtotime($sql_row["dt"]));
+ $biggest_donation_value = $amount;
}
- $total_year += $amount;
}
+ $total_year += $amount;
}
}