I have the following code and $totalDonations should output 1500.
<?php
$donations = $wpdb->get_results("
SELECT amount
FROM wp_fullstripe_payments
");
?>
<?php $totalDonations = array_sum($donations); ?>
<?php echo $totalDonations; ?>
I get 0 from $totalDonations.
Here is the var_dump for $donations:
array(2) { [0]=> object(stdClass)#2108 (1) { ["amount"]=> string(3) "500" } [1]=> object(stdClass)#2107 (1) { ["amount"]=> string(4) "1000" } }
This doesn't work either:
<?php echo $donations[0]; ?>