source: subversion/sites/donate.openstreetmap.org/scripts/update_total_raised.php @ 17464

Revision 17464, 662 bytes checked in by gslater, 5 years ago (diff)

update donate.osm.org: Add base for OpenStreetMapS.org purchase fund. CODE UGLY. Text to follow.

  • Property svn:eol-style set to native
Line 
1<?
2/* REALLY UGLY */
3$goal = 10000;
4
5//CONNECT to DB
6include('../htdocs/process/db-connect.inc.php');
7
8
9$sql_query_total_raised = 'SELECT SUM( `amount_gbp` ) AS `total` FROM `donations` WHERE `processed` =1';
10$sql_result = mysql_query($sql_query_total_raised, $_DB_H) OR die('FAIL UPDATING: '.$sql_query_total_raised);
11if ($sql_result AND mysql_num_rows($sql_result)==1) {
12        $total = mysql_fetch_array($sql_result ,MYSQL_ASSOC);
13        $fp = fopen('raised.inc.html', 'w');
14        $raised_string  = number_format($total['total']);
15        $raised_percent = number_format( ($total['total']/$goal*100),2);
16        fwrite($fp, '£ '.$raised_string.' ('.$raised_percent.'%)');
17        fclose($fp);
18}
19?>
Note: See TracBrowser for help on using the repository browser.