Hi everyone,
I’m trying to pull all of the sales subtotals together from my database for the previous month, this is where I am so far but I cannot get the date format to work correctly.
Any help would be appreciated
[php]<?php
if (mysqli_connect_errno($db)) {
trigger_error('Database connection failed: ’ . mysqli_connect_error(), E_USER_ERROR);
}
$currentdate = date(‘Y-m-d’); // I know this is the current date
$sql=“SELECT SUM(subtotal
) AS sales FROM fms_tbl_invoicing WHERE client_id= ‘{$_SESSION[‘client_id_of_user’]}’ AND date
LIKE ‘$currentdate’%”;
while($sales = mysqli_fetch_assoc($result)) {
echo number_format(floatval($sales[‘sales’]),2);
}
?> [/php]