marksie1988 Posted August 26, 2009 Share Posted August 26, 2009 Hi, i am looking into creating an application in php mysql that we could put sales figures in for the week etc. i am a bit confused though as to how i could go about working out the weeks e.g. there are 52 weeks in a year, i need the application to know what week it is (how would i achieve this?) and also say i went from 2009 to 2010 i would need it to go back to week 1. the main issue that i have is that i do need to keep the history of sales etc so that we can do a YTD figure and a weekly figure. all i need is some help or ideas or code snipets that would allow me to have 2009 week 1 to week 52 then move to 2010 week 1 to week 52 if you need more explanation please dont hesitate to ask. any help is much appreciated Regards Steve Quote Link to comment https://forums.phpfreaks.com/topic/172008-help-with-monitoring-year-week-and-sales-figures/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 26, 2009 Share Posted August 26, 2009 Mysql has a large number of date/time functions that you can use to query for the data you are interested in, for example you could GROUP BY using the WEEK() function to get weekly figures for a range of dates - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_week (see the page that link is part of for more useful date/time functions.) Quote Link to comment https://forums.phpfreaks.com/topic/172008-help-with-monitoring-year-week-and-sales-figures/#findComment-906969 Share on other sites More sharing options...
marksie1988 Posted August 26, 2009 Author Share Posted August 26, 2009 ahh yes i never thought of doing it that way, so i could basically create an entry for each sale made and then each on having a date i would be able to use php to create charts and reports etc. thankyou Steve Quote Link to comment https://forums.phpfreaks.com/topic/172008-help-with-monitoring-year-week-and-sales-figures/#findComment-906980 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.