Quote:
Originally Posted by calmlikeabomb
Assuming you've got your db connection established..
|
Well, (and not picking on any one in particular, so far all answers 2 have this problem) using the contains Jan works fine if we only have one years data in the db, otherwise we are going to get multiple years worth of data totalled.
(using Calm's statement as base)
$Total= mysql_result(mysql_query("SELECT SUM(total_income) AS Total FROM `db` WHERE payment_date LIKE '%Jan%' and payment_date like'2007'"),0);
However, it would be better to store the date in a proper date field and be able to hit it with a between function.