<slide title="Opening a Database">

<blurb>As with any database system the first thing you must do is open a database. Since SQLite is based on files,
opening a database differs very little from opening a regular file.</blurb>

<example fontsize="1.6em" title=""><![CDATA[<?php
	/* resource sqlite_open(string filename [, int mode [, string &error_message]]) */
	$db = sqlite_open("db.sqlite", 0666, $error) 
		or die("Failed to connect because: ".$error);
	/* opened a connection to memory only database */
?>]]>
</example>

<list>
	<bullet>PHP file system checks (safe_mode, open_basedir) are performed on the database path.</bullet>
	<bullet>If the database does not exist it will be created.</bullet>
	<bullet>The optional mode parameter can be used to open the database in read-only mode.</bullet>
</list>

</slide>