I need to know how to design the dates part of my code in order to dynamically get data from my db for the last six months, and then display the info, per month. Remember, this all has to happen dynamically, its for a statistics report...
Any code examples or general tips would help a great deal
Thanks so long
Getting info for the last six months - dates problem
Moderator: General Moderators
What does your table look like? Mysql has some great date and time functions that can help you...
http://dev.mysql.com/doc/refman/5.0/en/ ... tions.html
http://dev.mysql.com/doc/refman/5.0/en/ ... tions.html
this is a replica of what the actual output of data should have had to look like....
Then, eventually, i figured out how to get the information, using variables: eg var1, var2, var3 by running a while loop, to increment the number after 'var' and then display.
But... that made the info display underneath each other:
...which is not what i wanted.
So, after much pondering and then some, i just realised, shortcuts wont work in this case....
i posted this this morning, but i think it got blocked, cos i didnt put code tags around the code. did that and my problem is sorted out now, thanks, but now i have another problem:
How would i go about getting the top 10 entries for a certain month?
eg. there are a hundred projects in my database (msql) and i would like to see which 10 were viewed the most during the last month...
Code: Select all
[color=green]<table>
<tr>
<td></td><td>Feb</td><td>Jan</td><td>Dec</td><td>Nov</td><td>Oct</td><td>Sep</td>
<td>Clients</td><td>Feb Info</td><td>Jan Info</td><td>Dec Info</td><td>Nov Info</td><td>Oct Info</td><td>Sep Info</td>
</tr>
</table>[/color]But... that made the info display underneath each other:
Code: Select all
[color=green]<tr><td>Feb Info</td></tr>
<tr><td>Jan Info</td></tr>
<tr><td>Dec Info</td></tr>
<tr><td>Nov Info</td></tr>
<tr><td>Oct Info</td></tr>
<tr><td>Sep Info</td></tr>[/color]So, after much pondering and then some, i just realised, shortcuts wont work in this case....
i posted this this morning, but i think it got blocked, cos i didnt put code tags around the code. did that and my problem is sorted out now, thanks, but now i have another problem:
How would i go about getting the top 10 entries for a certain month?
eg. there are a hundred projects in my database (msql) and i would like to see which 10 were viewed the most during the last month...
Last edited by tamiya on Tue Feb 07, 2006 3:13 am, edited 1 time in total.