Working with the Framework

The work we have done so far deals with central control, command selection, and view dispatch. Although we have examined the source code in detail, getting a sense of the code’s functionality is difficult without trying it first.

We are going to build a very basic example. We’ll create code for extracting task data from, and adding task data to, a database, concentrating on two views and two commands.

We will use a MySQL database and a task table that can be created with the following statement:

CREATE TABLE tasks (
 id int(11) NOT NULL auto_increment,
 summary varchar(255) default NULL,
 description text,
 person varchar(255) default NULL,
 PRIMARY KEY (id)
);

You might want to refer to Listing 24.1 to remind yourself ...

Get Sams Teach Yourself PHP in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.