I am trying to get the sum of the sales for the last week / month with php and mysql pdo. The sales date saved in unix timestamp format in database.
This is how I'm doing it right now;
$week = strtotime("+1 Week");
$getsales = $odb -> prepare("SELECT SUM(`amount`) FROM `sales` WHERE `date` < :date");
$getsales -> execute(array(':date' => $week));
Can someone give me a better way for it ?