In Appendix D, "Database Normalization and SQL Reference," you learned about the importance of a normalized database and potential problems with the flat file. However, there are many instances in which your PHP applications might only need a single database table, and there's nothing wrong with that. For instance, suppose you're just archiving the content of simple contact forms set through your website, as a backup in case the e-mailed versions never arrive. This simple table might have fields for name, e-mail address, comments, and date sent—no real need to normalize that!
If you find yourself in a development situation without a database and some mandate that you must not install one, PHP 5 introduces another option into the mix—the capability to utilize SQLite, which is a flat file database with an SQL-based interface.
| Note |
SQLite is enabled by default in PHP 5. For detailed information beyond what's covered in this appendix, please visit the SQLite website at http://www.sqlite.org/, or search the PHP manual section for SQLite at http://www.php.net/sqlite/. |
To use SQLite, you must still have a fundamental understanding of how databases, tables, and fields all work together, and SQL syntax itself. Everything you have learned in this book is still viable with regards to the process of connecting to a database, issuing queries, and obtaining results—except that you learned to use the MySQL-specific functions for sending the commands to the MySQL server. SQLite has its own set of functions that you use to perform the same types of tasks.