I am trying to sum the total value of one column....
I have it working for doing sum of other columns, yet this colum wont sum and I don't get a value echo'd.
Anyone have any suggestions why, the formatting of the colum return is the exact same as profit (decimal 5,2)
PHP - Working one
<div class="col-md-2 col-md-2-2">
<div class="card mt-5">
<div class-title>
<h3 role="button" class="bg-secondary text-white text-
center py-3">Stake Placed<br></h3>
</div>
<div class="card-body">
<table class='table table-bordered'>
<?php
$connection = mysqli_connect("******", "******",
"******", "******");
if (!$connection) {
die("Database connection failed: " . mysqli_connect_error());
}
$Date = '2019-03-11';
$ssql="SELECT sum(stakePlaced) as total FROM bets WHERE betDate = '$Date'";
$sresult = mysqli_query($connection, $ssql);
while ($srow = mysqli_fetch_assoc($sresult))
{
echo "<tr>";
echo "<td class='text-center'>£".$srow['total'] . "</td>";
echo "</tr>";
}
mysqli_close($connection);
?>
</table>
</div>
</div>
</div>
PHP - Not Working one
<div class="col-md-2 col-md-2-2">
<div class="card mt-5">
<div class-title>
<h3 role="button" class="bg-secondary text-white text-
center py-3">Actual Return<br></h3>
</div>
<div class="card-body">
<table class='table table-bordered'>
<?php
$connection = mysqli_connect("******", "******",
"******", "******");
if (!$connection) {
die("Database connection failed: " . mysqli_connect_error());
}
$Date = '2019-03-11';
$test = "SELECT sum(return) as total FROM bets WHERE betDate = '$Date'";
$testr = mysqli_query($connection, $test);
while ($testrow = mysqli_fetch_assoc($testr))
{
echo "<tr>";
echo "<td class='text-center'>£".$testrow['total'] . "</td>";
echo "</tr>";
}
mysqli_close($connection);
?>
</table>