Trying to display a summary table (from data already written) [accumulator?) « on: Today at 09:41:47 AM »Quote Modify I have pulled out a chronicle of data using 'include' (and strtok) and have displayed it in a table using a While loop. What I need to do is summarize that data. It would be great if foreach wasn't only for array's as I must keep my While loop. So, I basically just have generic table of data with assigned attributes to work with at the moment. The data is regarding computers (via serial number), number of times these computers were serviced, and the cost for each repair. Now I need to display a summary as there are only about 10 computers and many are listed multiple times. In this summary I want to display the total number of times serviced (repaired) and the total cost from all repairs for each computer each on a separate line. I feel I should be doing something like .... $cost = $cost + $cost echo $cost much like an accumulator but I haven't had any luck with that. I really just need to be pointed in the right direction. Thanks
I have displayed a table using a while loop and I want to keep that, I don't want to change it. I just want to add on to it a second table to summarize totals from my first table and I can't find a function that will do that.
yes I realise that, I mean what does the MYSQL table look like? For instance What are the column names and types What code do you have currently It helps to show code to get help with a problem. Otherwise it's just guesswork Is this data coming from a MYSQL database or somewhere else???