Browse Source

Cleanup

pull/12/head
falkTX 7 years ago
parent
commit
5bf9547b02
1 changed files with 17 additions and 14 deletions
  1. +17
    -14
      DonationsStats.php

+ 17
- 14
DonationsStats.php View File

@@ -14,6 +14,11 @@ $total_ever = 0.0;

function print_donation_year($year) {

if ($db_link == false) {
echo '<tr><td colspan="6">DB connection failed</td></tr>';
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;
}
}



Loading…
Cancel
Save