phpHoo, Part I | 3
phpHoo, Part I
This tutorial will cover the basics of integrating PHP with a database, in this case, MySQL. MySQL is arguably the fastest SQL server available, and the price can't be beat: It's free for non-commercial purposes. (See the MySQL license for more details). It's my personal favorite amongst SQL engines when performance and development time are factors. The original perlHoo was developed in less than a week. phpHoo was developed to match perlHoo part I in -three hours-, and exceeded perlHoo part II in less than 6 hours over the course of 2 days.
Notes about this Tutorial
PHP is a more structured language than Perl. As such, a linear discussion of phpHoo's internals is not possible. perlHoo is a "top down" linear program. The program begins executing on line one and progresses through the code until the end, with required subroutines at the bottom of the file. PHP is not a linear language. It requires that all user defined functions and methods be defined before they can be called, which means that they appear at the beginning of the source file and the logic which uses them is at the bottom of the file. phpHoo is also a much larger tutorial with a more complex program design. We're covering a lot of topics here, from basic MySQL functionality and database design concepts to PHP constructs, Classes and Object Oriented programming. We'll begin by creating the MySQL database and a Class file to work with that database. After we've done all of that, we can actually sit down and work on phpHoo's internals.
Getting PHP and MySQL installed
This is a usage tutorial and as such, instructions for the installation of PHP or MySQL is beyond the realm of this tutorial. PHP and MySQL will both work on Win32 or Unix platforms. MySQL can be obtained from the MySQL home at http://www.mysql.com. PHP can be obtained at http://www.php.net/. Both sites include pointers and instructions on how to install the software and common problems associated with their install or usage. There are also web archives of the PHP and MySQL mailing lists, which can be a treasure trove of information on how to install and use the software. One searchable site that archives all the major PHP and MySQL mailing lists is at Progressive-Comp, http://www.progressive-comp.com/Lists/.
Produced by Jonathan
Created: July 20, 1999
Revised: July 20, 1999