Home arrow PHP arrow Introduction to Using SQLite with PHP 5

Introduction to Using SQLite with PHP 5

If you use PHP 5 to build web-based applications that access a database, you might want to consider SQLite. A "lighter" option than MySQL, this database may still suit your purposes if you don't need all of MySQL's bells and whistles. This three-part series covers many of SQLite's most useful features.

  1. Introduction to Using SQLite with PHP 5
  2. The basics of SQLite
  3. Retrieving rows from a database table
  4. Examining a few more row-fetching methods
By: Alejandro Gervasio
Rating: starstarstarstarstar / 26
December 04, 2006

print this article




On today's Web it is quite common to find websites that use some kind of database as an appropriate backend for housing their dynamic content. This content will be served to disparate site visitors by using either a procedural or an object-based application layer in conjunction with the corresponding presentation mechanism.

Although the situation that I described above seems to grow increasingly common as the Web expands its apparently endless boundaries, I have to admit that this topic isnít exactly the subject of this series. Instead, the question that Iíd like to ask is the following: how many times during your life as PHP developer have you found yourself wishing to have at your disposal an RDBMS other than MySQL to fit your data storage requirements?

Indeed, if youíre working on a particular web project that isnít too demanding in terms of using a full-featured relational database system, the answer to the previous question should be "frequently." If the neatly-crafted PHP application that youíre currently developing needs to use an RDBMS, but doesn't require the utilization of the numerous, and sometimes overwhelming features offered by MySQL, I have good news for you.

If youíve been using PHP 5 for a while, maybe youíve heard several comments about the cool RDBMS called ďSQLite,Ē which comes embedded with the latest incarnation of the language. This feature is truly handy, since thereís no need to use a separate piece of software (like MySQL for instance) to build a database application.

To be a little bit more specific concerning the topic, SQLite will let you perform most of the tasks you used to achieve with MySQL, like running buffered and unbuffered queries against a selected database, processing result sets in all sorts of clever ways, counting and seeking rows, and much more, by using only a group of intuitive methods (or functions, when using a procedural approach). Isnít this great?

Considering the numerous and handy features that come with the SQLite RDBMS, in this three-part series Iíll be introducing some of the most relevant ones. In this way you can start using them as part of your PHP 5-based applications.

However, Iíd like to clarify one more thing before diving into the subject: all the hands-on examples that youíll learn here will use the object-based API included with this library. If youíre inclined to work with a procedural method, I suggest you take a look at the PHP manual to cover in detail this specific approach.

With the preliminaries out of our way, itís time to start discovering many of the useful methods that come bundled with SQLite. Letís do it together!

>>> More PHP Articles          >>> More By Alejandro Gervasio

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: