jdlev Posted July 8, 2013 Share Posted July 8, 2013 I'm looking for the most efficient way to do this: 1) User enters number of days to see sales (ex. 30) 2) Database holds day (ex. 2013-07-08) & total sales for that day. 3) Data is sent to an array (or would a text or xml file be better to access the data?) 4) Data is extracted from array/file/xml and inserted into a graph to display data. So I suppose I could just run a for loop that looks at the database for 30 days, and returns all data, and the for loop packs the info into an array. Another way I guess I could do it is to give the SQL query an argument that says any days for today minus thirty days, add that information to an array. How would you guys go about doing it to maximize efficiency? Quote Link to comment https://forums.phpfreaks.com/topic/279968-how-should-i-organize-data-for-a-graph-from-mysql-data/ Share on other sites More sharing options...
Barand Posted July 12, 2013 Share Posted July 12, 2013 You would select the data with a WHERE clause such as "WHERE datefield BETWEEN CURDATE() - INTERVAL 30 DAY AND CURDATE()". How you then store the results for a graph would depend on the requirements of the software you are using to produce the graph Quote Link to comment https://forums.phpfreaks.com/topic/279968-how-should-i-organize-data-for-a-graph-from-mysql-data/#findComment-1440508 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.