In this new post today Gonzalo Ayuso shows how to make "pivot tables" (at least the concept) in a PHP script to modify a data set and transform it into something else.
It's not very difficult to handle pivot tables by hand but the work is always the same: groups by, totals, subtotals, totals per row... Now I want to write a class to pivot tables in PHP with the most common requirements (at least for me).
His examples takes a few rows of records from a MySQL result and shows how, with the help of a library he's developed, he can make a few commands and fetch just the data he needs including the column to pivot on. A few more examples are also included.