Having issues working with dates in PHP, very new aspect of PHP for me. Couple things I'm trying to accomplish and wouldn't mind a simple tutorial/explanation of since everything I'm finding assumes I know more than I do:
1. How to sort by dates?
Currently I am trying to query log of information for bills and payments, ordered by their due date. I want to group this query by months, so as of right now I'm using this:
$sql = "select * from $table WHERE MONTH(date) between '11' and '12'"; $query = mysql_query($sql);
Then I display the query as needed, then close the sql, then reopen and use another query for the previous month; which I'm not sure how to do just yet. For some reason this currently pulls some of Nov and Dec, not just Nov or Dec like I want.
2. How can this be dynamic
This whole project I expect to be dynamic so I don't want to hardcode dates, but rather I want it to use today's date (which I think is the today() function) to determine $this_month, and the descend to the previous month, possible as far as 1 year back at the most.
Is it possible to do something like this in a loop? I am new to PHP but I learn quickly when things are explained well for me to grasp and I've programmed in other languages, AS2 (Flash) is my primary language.
Hope that helps you help me, thanks in advance for anything you guys can offer, means a lot, already you guys have helped me grow leaps and bounds on this project.