Main Content

Giving the researcher power over database analysis

Archive - Originally posted on "The Horse's Mouth" - 2006-01-22 01:13:18 - Graham Ellis

Sometimes, you'll be able to define the queries you'll be doing on a database to a number of specific types, but in other applications you'll be able to narrowly define how you do your joins, but you'll have a wide variety of extraction requirements. This sort of requirement is typical of medical researchers, who have a database of information that they've gathered over the years and they want to look at the results in all sorts of different ways in order to find patterns and trends in the data. From such patterns and trends will come the clues from which an understanding develops, and from which in turn, and in time, a cure can be found.

So how do you ensure that the strange and adhoc queries that you wish to run maintain the integrity of the background data? One very good way is by fronting your MySQL database with a PHP script which forces you to do the correct joins between the tables to ensure the data integrity, but gives you full flexibility in the columns you select and in your where clauses.

On the course concluded last Friday, I wrote a demonstration PHP page to show this type of application, and as it's of general interest I've put all the source code and help files up on this site. I've also installed a full working copy on our server if you wish to try it out. You're very welcome to log in as demo with a password of xxx111.

This is a VERY flexible application. I could just change a few configuration lines and it would switch from estate agents and houses for sale to some totally different set.

If you want to learn how to write an application like this yourself, or how to tailor and look after mine, have a look at our PHP courses and MySQL courses. If you're already into PHP and MySQL, our Opentalk Forum provides a venue where you can ask any remaining questions you have and discuss the best techniques.