Hi Guys,
Im not sure how to word the title of this question, but i have a table called "daily_recyclables". Inside this table, i have multiple columns of recyclable materials (example copper, stainless steel, brass etc etc)
In my PHP application, i have a statistic card (like below) that is supposed to display the total weight of each material in that table based on the current month we are in.
Heres a screenshot of the daily_recylables page to give you an idea: https://ibb.co/sybSC5w
This is my attemp to achieve that which is not working at all, and i do not even know how to make it display based only on entries in the current month automatically.
<?php
$hostname="localhost";
$username="EXAMPLE";
$password="EXAMPLE";
$db = "EXAMPLE";
$dbh = new PDO("mysql:host=$hostname;dbname=$db", $username, $password);
foreach($dbh->query('SELECT SUM(weight)
FROM subgrade_bin WHERE subgrade = ?') as $row) {
echo "<tr>";
echo "<td>" . $row['SUM(weight)'] . "</td>". " KG";
echo "</tr>";
}
?>
Can someone guide this newby to some resources to assist me on how to do this?
My Table Columns are:
recID (INT AUTO INCREMENT), date,subgrade,castaluminium,copper,stainlesssteel,plastic,batteries,brass,lowgradePCB,mediumgradePCB,highgradePCB.