Step 3: Reloading Webserver and Checking New Settings
At this point, restart your webserver. Using the phpinfo() function you
should now see a page listing a section indicating SQLite support
installed. Next we will proceed to describing the basics of interacting
with an SQLite database. Keep in mind, most of the following can be
found at http://www.php.net/sqlite.
At this point, restart your webserver. Using the phpinfo() function you
should now see a page listing a section indicating SQLite support
installed. Next we will proceed to describing the basics of interacting
with an SQLite database. Keep in mind, most of the following can be
found at http://www.php.net/sqlite.
<?php
$con = sqlite_open("database");
$set = sqlite_query("select * from foo limit 1");
$row = sql_fetch_array($set);
sqlite_close($con);
print_r($row);
?>
This code very simply opens up (or creates and then opens) a file
‘database’. If you have worked with ANY database extension within PHP
the next command should be obvious to you. We are going to select
everything from the table foo but only keep one row. Then we fetch the
results in an array representing the single row. Then we use print_r to
show what values were fetched from the row.
‘database’. If you have worked with ANY database extension within PHP
the next command should be obvious to you. We are going to select
everything from the table foo but only keep one row. Then we fetch the
results in an array representing the single row. Then we use print_r to
show what values were fetched from the row.
As discussed earlier, there being no engine in SQLite, the sqlite_open
function serves to both establish a connection and select the database.
function serves to both establish a connection and select the database.
I would like to thank the following people for their time in helping me
write this article:
Generic_Badass
Joey Smith (TML)
Sara Golemon (Pollita)
write this article:
Generic_Badass
Joey Smith (TML)
Sara Golemon (Pollita)