| ID |
Customer Name |
Customer Email |
Date/Time |
Payment |
prepare("SELECT * FROM tablename");
$stmt->execute();
$result = $stmt->get_result();
if($result->num_rows > 0) {
while($rows = $result->fetch_all(MYSQLI_ASSOC)) {
$price = array_column($rows, 'price'); // <== price is column name of the price column. So you may replace this if the name of column is not price
$sumprice = array_sum($price);
foreach($rows as $row) {
echo "| ".$row['id']." | ".$row['name']." | ".$row['email']." | ".$row['timestamp']." | ".$row['payment']." |
"; // the values inside $row[] is column names. You need to replace these names with the column names you are using in your table
}
echo "";
echo "| Total Gross | ";
echo "".$sumprice." | ";
echo "
";
}
}
?>