Changeset View
Changeset View
Standalone View
Standalone View
fundraisers/randameetings2016/stats.php
Show First 20 Lines • Show All 219 Lines • ▼ Show 20 Line(s) | 218 | <?php | |||
---|---|---|---|---|---|
220 | $page_title="Randa Meetings 2016 fundraising"; | 220 | $page_title="Randa Meetings 2016 fundraising"; | ||
221 | 221 | | |||
222 | $goal=24000; | 222 | $goal=24000; | ||
223 | $enddate="2016-07-11"; | 223 | $enddate="2016-07-11"; | ||
224 | $daystogo=floor((strtotime($enddate)-time())/(60*60*24)); | 224 | $daystogo=floor((strtotime($enddate)-time())/(60*60*24)); | ||
225 | 225 | | |||
226 | require("donations_auth.inc"); | 226 | require("donations_auth.inc"); | ||
227 | 227 | | |||
228 | $query = "select sum(amount) as amount_sum, count(*) donations, DATE_FORMAT(date, '%m%d') as date_fmt from randameetings2016donations group by DATE_FORMAT(date, '%m%d') ORDER BY DATE_FORMAT(date, '%m%d');"; | 228 | $stmt = $dbConnection->prepare("select sum(amount) as amount_sum, count(*) donations, DATE_FORMAT(date, '%m%d') as date_fmt from randameetings2016donations group by DATE_FORMAT(date, '%m%d') ORDER BY DATE_FORMAT(date, '%m%d');"); | ||
229 | $q = mysql_query($query,$sq); | 229 | $stmt->execute(); | ||
230 | echo mysql_error(); | | |||
231 | $labels2016 = ""; | 230 | $labels2016 = ""; | ||
232 | $values2016 = ""; | 231 | $values2016 = ""; | ||
233 | $cumulativeAmount2016 = ""; | 232 | $cumulativeAmount2016 = ""; | ||
234 | $cumulativeAmount2016Value = 0; | 233 | $cumulativeAmount2016Value = 0; | ||
235 | $cumulativeDonations2016 = ""; | 234 | $cumulativeDonations2016 = ""; | ||
236 | $cumulativeDonations2016Value = 0; | 235 | $cumulativeDonations2016Value = 0; | ||
237 | $donations2016 = ""; | 236 | $donations2016 = ""; | ||
238 | $count = 1; | 237 | $count = 1; | ||
239 | while ($row = mysql_fetch_array($q)) { | 238 | while ($row = $stmt->fetch()) { | ||
240 | //$labels2016.=", ".$row["date_fmt"]; | 239 | //$labels2016.=", ".$row["date_fmt"]; | ||
241 | $labels2016.=", ".$count; | 240 | $labels2016.=", ".$count; | ||
242 | $count++; | 241 | $count++; | ||
243 | $values2016.=", ".$row["amount_sum"]; | 242 | $values2016.=", ".$row["amount_sum"]; | ||
244 | $cumulativeAmount2016Value += $row["amount_sum"]; | 243 | $cumulativeAmount2016Value += $row["amount_sum"]; | ||
245 | $cumulativeAmount2016.=", ".$cumulativeAmount2016Value; | 244 | $cumulativeAmount2016.=", ".$cumulativeAmount2016Value; | ||
246 | $cumulativeDonations2016Value += $row["donations"]; | 245 | $cumulativeDonations2016Value += $row["donations"]; | ||
247 | $cumulativeDonations2016.=", ".$cumulativeDonations2016Value; | 246 | $cumulativeDonations2016.=", ".$cumulativeDonations2016Value; | ||
248 | $donations2016.=", ".$row["donations"]; | 247 | $donations2016.=", ".$row["donations"]; | ||
249 | } | 248 | } | ||
250 | $labels2016.=""; | 249 | $labels2016.=""; | ||
251 | $values2016.=""; | 250 | $values2016.=""; | ||
252 | $cumulativeAmount2016.=""; | 251 | $cumulativeAmount2016.=""; | ||
253 | $cumulativeDonations2016.=""; | 252 | $cumulativeDonations2016.=""; | ||
254 | $donations2016.=""; | 253 | $donations2016.=""; | ||
255 | 254 | | |||
256 | $query = "select sum(amount) as amount_sum, count(*) donations, DATE_FORMAT(date, '%m%d') as date_fmt from randameetings2015donations group by DATE_FORMAT(date, '%m%d') ORDER BY DATE_FORMAT(date, '%m%d');"; | 255 | $stmt = $dbConnection->prepare("select sum(amount) as amount_sum, count(*) donations, DATE_FORMAT(date, '%m%d') as date_fmt from randameetings2015donations group by DATE_FORMAT(date, '%m%d') ORDER BY DATE_FORMAT(date, '%m%d');"); | ||
257 | $q = mysql_query($query,$sq); | 256 | $stmt->execute(); | ||
258 | echo mysql_error(); | | |||
259 | $labels2015 = ""; | 257 | $labels2015 = ""; | ||
260 | $values2015 = ""; | 258 | $values2015 = ""; | ||
261 | $cumulativeAmount2015 = ""; | 259 | $cumulativeAmount2015 = ""; | ||
262 | $cumulativeAmount2015Value = 0; | 260 | $cumulativeAmount2015Value = 0; | ||
263 | $cumulativeDonations2015 = ""; | 261 | $cumulativeDonations2015 = ""; | ||
264 | $cumulativeDonations2015Value = 0; | 262 | $cumulativeDonations2015Value = 0; | ||
265 | $donations2015 = ""; | 263 | $donations2015 = ""; | ||
266 | $count = 1; | 264 | $count = 1; | ||
267 | while ($row = mysql_fetch_array($q)) { | 265 | while ($row = $stmt->fetch()) { | ||
268 | //$labels2015.=", ".$row["date_fmt"]; | 266 | //$labels2015.=", ".$row["date_fmt"]; | ||
269 | $labels2015.=", ".$count; | 267 | $labels2015.=", ".$count; | ||
270 | $count++; | 268 | $count++; | ||
271 | $values2015.=", ".$row["amount_sum"]; | 269 | $values2015.=", ".$row["amount_sum"]; | ||
272 | $cumulativeAmount2015Value += $row["amount_sum"]; | 270 | $cumulativeAmount2015Value += $row["amount_sum"]; | ||
273 | $cumulativeAmount2015.=", ".$cumulativeAmount2015Value; | 271 | $cumulativeAmount2015.=", ".$cumulativeAmount2015Value; | ||
274 | $cumulativeDonations2015Value += $row["donations"]; | 272 | $cumulativeDonations2015Value += $row["donations"]; | ||
275 | $cumulativeDonations2015.=", ".$cumulativeDonations2015Value; | 273 | $cumulativeDonations2015.=", ".$cumulativeDonations2015Value; | ||
▲ Show 20 Lines • Show All 174 Lines • Show Last 20 Lines |