How can I get data from SQL using PHP of this month (not last 30 days). If this is January 10, I wan to collect data from January 1 to January 10.
I tried the following code, but it seems to be taking data from last month also!
$sql = "SELECT SUM(earnings)
FROM tablename
WHERE username='$membername'
AND date > DATE_SUB(NOW(), INTERVAL 1 MONTH)";
in database date in saved in following format 2020-12-26 10:02:41