PHP Basics, Part 2: Database-Driven Pages
Introduction
Part 1 of this series on PHP basics looked at the basic structure of a page, including variables, looping, and HTML forms. In the process, we created the first part of an event-information system, with a monthly calendar displayed based on the month chosen in the form.
In Part 2, we'll add a database to the mix by creating the pages that add events to the database, and the pages that display information that has already been stored. (In Part 3, we'll create objects to represent each event.)
To follow along with the examples, you'll need a web server that supports PHP. Many web hosts provide PHP support, or you can download PHP for free at the PHP web site. You'll also need access to a database. These examples use MySQL, available for free at the MySQL web site. The concepts apply to any database, but MySQL is the database most commonly used with PHP.
NOTE
To download a zip file containing the source files for this article, click here.