Prev | Current Page 645 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

db")
or die("Could not connect!");
?>
This either opens an existing database named corporate.db, creates a database
named corporate.db within the directory /home/book/22/, or results in an error, likely
because of privilege problems. If you experience problems creating or opening the
database, be sure that the user owning the Web server process possesses adequate
permissions for writing to this directory.
Opening a Persistent SQLite Connect
The function sqlite_popen() operates identically to sqlite_open() except that it uses
PHP??™s persistent connection feature in an effort to conserve resources. Its prototype
follows:
resource sqlite_popen(string filename [, int mode [, string &error_message]])
The function first verifies whether a connection already exists. If it does, it reuses this
connection; otherwise, it creates a new one. Because of the performance improvements
offered by this function, you should use sqlite_popen() instead of sqlite_open().
OBJECT-ORIENTED SQLITE
Although this chapter introduces PHP??™s SQLite library using the procedural approach, an objectoriented
interface is also supported. All functions introduced in this chapter are also supported as
methods when using the object-oriented interface. However, the names differ slightly in that the
sqlite_ prefix is removed from them. Therefore, the only significant usage deviation is in regard to
referencing the methods by way of an object ($objectname->methodname()) rather than by passing
around a resource handle.


Pages:
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657