| 
	
 | 
 Posted by mantrid on 12/30/07 16:02 
> 
> How about this for an approach? 
> 
> 1) Read the data in the order needed to compute the cumulative total. 
> 
> 2) As each row of the table is generated, do not emit it, but store the 
> whole line (from <tr> to </tr>) in an array, with the the date value as 
> the index. (Use yy/mm/dd format for the key, so it will sort.) 
> 
> 3) Sort the array keys into a new array. 
> 
> 4) Foreach key in new array, print the value at that index from the 
> array created in step 2. 
> 
> 5) Close the table. 
> 
> That way you don't need to read the database twice. 
> 
> If your table is so large that it needs to be displayed on more than one 
> page, then you will have to compute the cumulative values and store them 
> in the database. Make sure the cumulative values are updated when any of 
> the colC values are changed. 
> 
> Display of the sub-set required can then be accomplished with order by 
> and limit clauses, and the use of SQL_CALC_FOUND_ROWS will tell you if 
> NEXT and/PREV buttons are needed for this page. 
> 
> Regards 
> 
> Ian 
 
Thanks Ian 
This is what Ivan has also suggested on the thread on comp.lang.php. Dont 
know why those messages are not showing up here on alt.comp.lang.php. 
Ian
 
  
Navigation:
[Reply to this message] 
 |