Jump to content

How should I organize data for a graph from MySQL data?


jdlev

Recommended Posts

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.