Ok. Your site has recorded the data you want, now you want to display it in an easy to read format. The first method that comes to mind is simply to put the data in an HTML table. Although this is probably the easiest way out, there is a much better way of displaying your information: a graph. This was originally only possible by using sneaky tables with
<tr>‘s of different lengths. But now, thanks to the GD library and PHP, you can actually have a PNG or JPG image generated dynamically from data in a MySQL database. This article will help you start out in dynamic image generation.
The technical requirements for this article are listed below:
- PHP Scripting language (obviously): Without this language, this article is absolutely useless. If you don’t have it, stop reading and get it now!
- MySQL Server: For data storage. Any other SQL (Oracle, MSQL, etc.) would be fine, this is just my personal preference. The queries in this article were written for MySQL, however, and to use another SQL would mean you would have to translate them.
- GDLib: An extension to PHP that offers image manipulation capabilities. It can be found at http://www.boutel.com/gd. Installation of this extension is unique to each environment that it is being set up in, and will not be covered.
- Any paint program: To draw the base image for the graph (there is not artistic talent required, don’t worry).
Once you have all of these set up and running, you are ready to start coding.