Archive for the 'Databases' Category

Flexible Data Display with PDO and HTML_Table_Matrix

Have you ever wanted to set up an application that displays tabular data, and wanted to use the same view for each query?  While PHP is excellent for writing small-footprint queries, its ability to be embedded in HTML leaves the creativity to the programmer to figure out a consistent display solution for tabular data.

We need two things – first, we need a way to dynamically retrieve table information, query information, and query results.  Second, we need a way to dynamically build the display based on the information we have.  Using the metadata methods of PDO, along with PEAR::HTML_Table_Matrix, we can do just this. Continue reading ‘Flexible Data Display with PDO and HTML_Table_Matrix’

MySQL Views to the Rescue!

I was recently presented with the challenge of aggregating database hits for content that is e-mailed and commented on.  My gut reaction was to think of a PHP script, or perhaps set of scripts to filter & count the database rows.  Script processing of data sets with proper ORM can yield very meaningful information to both the programmer and the end-user.  However this can be memory-intensive, and creating an ORM layer for such a simple task *could* be considered overkill.  This is when MySQL views can help you.

Continue reading ‘MySQL Views to the Rescue!’