Jump to content

Donation logs


Recommended Posts

I need some help with my donation logs.

Basically i want to view my total donation for last month can some help me code this in. I have tried this no result being displayed.

$blah=$db->query("SELECT SUM(payment) as total_payment FROM donations WHERE timestamp BETWEEN DATE_ADD( now( ) , INTERVAL -1 MONTH ) AND now() ");
echo $row['total_payment'];


this is my current script (Mccodes v2)

function view_donation_logs()
global $db,$ir,$c,$h,$userid;
if($ir['user_level'] > 2)
$_GET['st']=abs((int) $_GET['st']);
print "<h3>Donation Logs</h3>
<table width=100% cellspacing='1' class='table'> \n<tr style='background:gray'> <th>Time</th> <th>User</th> <th>Amount</th> <th>Item</th> <th>Qty</th> </tr>";
$q=$db->query("SELECT * FROM donations AS s LEFT JOIN users AS u ON s.buyer=u.userid ORDER BY s.id DESC LIMIT {$_GET['st']},$rpp ");
print "<tr><td>".date('F j Y g:i:s a', $r['timestamp'])."</td><td><a href=#viewuser.php?u={$r['buyer']}>{$r['username']}</a> [{$r['buyer']}]</td><td>\${$r['payment']}</td><td>{$r['item']}</td><td>{$r['quantity']}</td></tr> ";

print"</table><br />";
$q2=$db->query("SELECT id FROM stafflog");
print "Pages: ";
print "<a href='staff_logs.php?action=dlogs&st=$st'>$i</a> ";
stafflog_add("Looked at the donation logs");
Link to comment
Share on other sites

I PM'd you this:

$time=strtotime("-1 month");

$qm=$db->query("SELECT payment FROM donations WHERE timestamp>={$time}");





echo "Donations: \$".money_formatter($total,"").". <br />";


Basically, as I stated in another thread, if you think good and hard most of everything you need is in the mccode script, I took the part of cash that is circulated in the game, that counted all money, and used it adding WHERE timestamp>={$time} ...

$time=strtotime("-1 month"); Is docking off 31 days, from today's date, leaving only record payments showing from Jan, 2 2013 - Feb 2nd 2013...

Edited by lucky3809
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...