😕
As a beginning PHP programmer, I've developed brainlock over this programming question.
A MySql table gets data from users signing up for an email newsletter, including such info as email address and registration date.
I'm building an HTML table to display results by month/year from this table and others. One column is to show the grand total number of email signups by month/year, for example:
Aug 2003 10,000
July 2003 8,000
June 2003 7,800
And so on.
If made a query that gets the grand total number of signups as of now, using SELECT COUNT(*) FROM table WHERE regdate > 0;
I've also obtained the monthly number of signups using a SELECT month(FROM_UNIX(regdate) as mo, SELECT year(FROM_UNIX(regdate) as yr, COUNT(*) as total FROM table GROUP BY mo,yr ORDER BY mo DESC yr DESC;
Okay, so I've got the monthly totals, but I can't figure out how to derive and code the grand total of all signups by month/year and display them. I figure that I could take the current grand total for August and subtract the current August monthly total to get the grand total for July, and then repeat that process for June, May, etc.
Can anyone help with the code that could do this? Thanks in advance!