The MySQLResultSet Class

Not surprisingly, the MySQLResultSet class shown in Listing 9-1 has more data members and methods than the MySQLConnect class. However, in many ways, it's a much simpler class and requires much less explanation. To get an overview of this class, find all its data members and methods listed here data members private strSQL private databasename private connection private result public methods public function _construct strSQL, databasename, connection return current record public function getRow...

Extending Sqlite

SQLite comes packaged with PHP 5. It has advanced capabilities and a built-in object-oriented OO interface. Examining the classes and methods of SQLite is the ostensible reason for including this chapter but that's not the only reason. SQLite is a great addition to PHP, but because MySQL is so entrenched, programmers tend to ignore SQLite. Don't let the Lite in SQLite lead you to underestimate the capabilities of this database. Because it is bundled with PHP, there is no external server to...

The MySQLException Class

You can improve the functionality of a class when using inheritance by adding new methods or changing inherited ones. Changing inherited methods of a class is called overriding. In this particular case, the number of changes you can make to existing methods by overriding them is severely limited because, as you saw in Listing 10-1, there are only two non-final methods of the Exception class the constructor and the_toString method. Let's change both of these class MySQLException extends...

Is It the Holy Grail?

One very legitimate concern might be voiced over the inclusion of the SQLite-specific method sqliteCreateFunction, and this is certainly not the only database-specific capability provided by PDO.3 Doesn't providing database-specific functionality do exactly what we refrained from doing at the start namely, extending the PDO class The short answer is, unquestionably, yes. But the whole notion of a perfect database abstraction layer is a Holy Grail glimpsed here and there but never grasped....

The Code

Go ahead and download the code for your page navigator, and look it over. Notice that there are considerably more data members than in other classes discussed so far. Names have been chosen in an attempt to make the purpose of the variable explicit, and related variables have been grouped. We'll discuss these variables in the order in which they appear in the class file. The variable pagename is the name of the page that will contain the page navigator control. It could be replaced by _SERVER...

Creating the PageNavigator Object

In order to create the page navigator, you need the current page name and also the total number of image files the global _SERVER array supplies the name of the current page and getCount the total number of images. pagename totalcount di- gt getCount You only need to create the navigator if there is more than one page, so calculate that number first, as shown in the code in Listing 8-3. numpages ceil totalcount PERPAGE create if needed if numpages gt 1 nav new PageNavigator pagename,...