Changeset View
Changeset View
Standalone View
Standalone View
fundraisers/randameetings2017/stats.php
Show First 20 Lines • Show All 217 Lines • ▼ Show 20 Line(s) | 194 | </div> | |||
---|---|---|---|---|---|
218 | <?php | 218 | <?php | ||
219 | $page_title="Randa Meetings 2017 fundraising"; | 219 | $page_title="Randa Meetings 2017 fundraising"; | ||
220 | 220 | | |||
221 | $goal=20000; | 221 | $goal=20000; | ||
222 | $enddate="2017-09-17"; | 222 | $enddate="2017-09-17"; | ||
223 | $daystogo=floor((strtotime($enddate)-time())/(60*60*24)); | 223 | $daystogo=floor((strtotime($enddate)-time())/(60*60*24)); | ||
224 | 224 | | |||
225 | require("config.php"); | 225 | require("config.php"); | ||
226 | $stmt = $dbConnection->prepare("SELECT SUM(amount) AS amount_sum, count(*) donations, DATE_FORMAT(CREATED_AT, '%m%d') AS date_fmt FROM randameetings2017donations ORDER BY DATE_FORMAT(CREATED_AT, '%m%d');") or die ($dbConnection->error); | 226 | $stmt = $dbConnection->prepare("SELECT SUM(amount) AS amount_sum, count(*) donations, DATE_FORMAT(CREATED_AT, '%m%d') AS date_fmt FROM randameetings2017donations ORDER BY DATE_FORMAT(CREATED_AT, '%m%d');"); | ||
227 | $stmt->execute(); | 227 | $stmt->execute(); | ||
228 | $result = $stmt->get_result(); | | |||
229 | $stmt->close(); | | |||
230 | 228 | | |||
231 | $labels2017 = ""; | 229 | $labels2017 = ""; | ||
232 | $values2017 = ""; | 230 | $values2017 = ""; | ||
233 | $cumulativeAmount2017 = ""; | 231 | $cumulativeAmount2017 = ""; | ||
234 | $cumulativeAmount2017Value = 0; | 232 | $cumulativeAmount2017Value = 0; | ||
235 | $cumulativeDonations2017 = ""; | 233 | $cumulativeDonations2017 = ""; | ||
236 | $cumulativeDonations2017Value = 0; | 234 | $cumulativeDonations2017Value = 0; | ||
237 | $donations2017 = ""; | 235 | $donations2017 = ""; | ||
238 | $count = 1; | 236 | $count = 1; | ||
239 | while ($row = mysqli_fetch_array($result)) { | 237 | while ($row = $stmt->fetch()) { | ||
240 | //$labels2017.=", ".$row["date_fmt"]; | 238 | //$labels2017.=", ".$row["date_fmt"]; | ||
241 | $labels2017.=", ".$count; | 239 | $labels2017.=", ".$count; | ||
242 | $count++; | 240 | $count++; | ||
243 | $values2017.=", ".$row["amount_sum"]; | 241 | $values2017.=", ".$row["amount_sum"]; | ||
244 | $cumulativeAmount2017Value += $row["amount_sum"]; | 242 | $cumulativeAmount2017Value += $row["amount_sum"]; | ||
245 | $cumulativeAmount2017.=", ".$cumulativeAmount2016Value; | 243 | $cumulativeAmount2017.=", ".$cumulativeAmount2016Value; | ||
246 | $cumulativeDonations2017Value += $row["donations"]; | 244 | $cumulativeDonations2017Value += $row["donations"]; | ||
247 | $cumulativeDonations2017.=", ".$cumulativeDonations2016Value; | 245 | $cumulativeDonations2017.=", ".$cumulativeDonations2016Value; | ||
248 | $donations2016.=", ".$row["donations"]; | 246 | $donations2016.=", ".$row["donations"]; | ||
249 | } | 247 | } | ||
250 | $labels2017.=""; | 248 | $labels2017.=""; | ||
251 | $values2017.=""; | 249 | $values2017.=""; | ||
252 | $cumulativeAmount2017.=""; | 250 | $cumulativeAmount2017.=""; | ||
253 | $cumulativeDonations2017.=""; | 251 | $cumulativeDonations2017.=""; | ||
254 | $donations2017.=""; | 252 | $donations2017.=""; | ||
255 | 253 | | |||
256 | $stmt = $dbConnection->prepare("SELECT SUM(amount) AS amount_sum, count(*) donations, DATE_FORMAT(date, '%m%d') AS date_fmt FROM randameetings2016donations ORDER BY DATE_FORMAT(date, '%m%d');") or die ($dbConnection->error); | 254 | $stmt = $dbConnection->prepare("SELECT SUM(amount) AS amount_sum, count(*) donations, DATE_FORMAT(date, '%m%d') AS date_fmt FROM randameetings2016donations ORDER BY DATE_FORMAT(date, '%m%d');") or die ($dbConnection->error); | ||
257 | $stmt->execute(); | 255 | $stmt->execute(); | ||
258 | $result = $stmt->get_result(); | | |||
259 | $stmt->close(); | | |||
260 | 256 | | |||
261 | $labels2016 = ""; | 257 | $labels2016 = ""; | ||
262 | $values2016 = ""; | 258 | $values2016 = ""; | ||
263 | $cumulativeAmount2016 = ""; | 259 | $cumulativeAmount2016 = ""; | ||
264 | $cumulativeAmount2016Value = 0; | 260 | $cumulativeAmount2016Value = 0; | ||
265 | $cumulativeDonations2016 = ""; | 261 | $cumulativeDonations2016 = ""; | ||
266 | $cumulativeDonations2016Value = 0; | 262 | $cumulativeDonations2016Value = 0; | ||
267 | $donations2016 = ""; | 263 | $donations2016 = ""; | ||
268 | $count = 1; | 264 | $count = 1; | ||
269 | while ($row = mysqli_fetch_array($result)) { | 265 | while ($row = $stmt->fetch()) { | ||
270 | //$labels2016.=", ".$row["date_fmt"]; | 266 | //$labels2016.=", ".$row["date_fmt"]; | ||
271 | $labels2016.=", ".$count; | 267 | $labels2016.=", ".$count; | ||
272 | $count++; | 268 | $count++; | ||
273 | $values2016.=", ".$row["amount_sum"]; | 269 | $values2016.=", ".$row["amount_sum"]; | ||
274 | $cumulativeAmount2016Value += $row["amount_sum"]; | 270 | $cumulativeAmount2016Value += $row["amount_sum"]; | ||
275 | $cumulativeAmount2016.=", ".$cumulativeAmount2016Value; | 271 | $cumulativeAmount2016.=", ".$cumulativeAmount2016Value; | ||
276 | $cumulativeDonations2016Value += $row["donations"]; | 272 | $cumulativeDonations2016Value += $row["donations"]; | ||
277 | $cumulativeDonations2016.=", ".$cumulativeDonations2016Value; | 273 | $cumulativeDonations2016.=", ".$cumulativeDonations2016Value; | ||
▲ Show 20 Lines • Show All 174 Lines • Show Last 20 Lines |