PHPBuilder - SQLite Support for PHP4 Page 4



RSS Twitter
Articles Databases

SQLite Support for PHP4 - Page 4

by: Jason Farrell
|
August 24, 2004

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.
 
        <?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.
As discussed earlier, there being no engine in SQLite, the sqlite_open 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)

« Previous Page
1
|
2
|
3
|
4

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Jason Farrell

Comment:



Comment:

(Maximum characters: 1200). You have characters left.