- Introduction to POG
- Setting up PHP, MySQL etc.
- Designing your objects
- Generating your code
- Description of the generated code
- Edit configuration file
- The Setup Process
- Using the code: Save()
- Using the code: Get()
- Using the code: SaveNew()
- Using the code: GetList()
- Using the code: Delete()
- Using the code: DeleteList()
- Advanced: object relations
- Advanced: Set{Parent}()
- Advanced: Get{Parent}()
- Advanced: Add{Child}()
- Advanced: Get{Child}List()
- Advanced: Save(deep)
- Advanced: Delete(deep)
- Advanced: Add{Sibling}()
- Advanced: Set{Child}List()
- Advanced: Set{Sibling}List()
- Advanced: Get{Sibling}List()
- Advanced: DeleteList(deep)
- Customizing POG-generated code
- Customizing: Extending POG Objects
- Customizing: Plugins
- Examples
- Examples: User registration system
- Examples: User authentication
- Examples: Survey form
- Examples: Using POG with AJAX
- PDO: Introduction
- PDO: SQLite example
- PDO: Firebird example
- PDO: PostgreSQL example
- PDO: MySQL example
- PDO: ODBC example
- Troubleshooting
- Troubleshooting: Data appears encoded
- Troubleshooting: Can't regenerate object
- Troubleshooting: Can't seem to Save()
- Troubleshooting: Can't get object / object attributes from database
- Troubleshooting: Can't open zip file on Mac
- Troubleshooting: Setup screen is blank
- Videos
- Appendix: Creating table(s) manually
- Appendix: Regenerating objects
- Appendix: Generating objects using SOAP
- Case Study: Gravity GTD
- Case Study: Web Form Factory
Back to the Code Generator
The POG Weblog and RSS feed.
The POG Google group
PDO: SQLite example
Using Php 5.1+ with an SQLite database is very useful when your host doesn’t have MySQL already installed. More information about the SQLite database can be found here. In a few words: SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine
Using Php Object Generator, you can generate objects for Php 5.1 which connect to an SQLite database through the PDO interface.
The following example will show you how to create a simple feedback form using Php Object Generator and SQLite. Requirements: Php 5.1, SQLite 3:
First, create the feedback form HTML:

Check that the feedback form is correct by opening it in your browser:

Download the code

Since we are using the SQLite database instead of MySQL, we need to perform a few more steps before we’re able to use the POG-generated code.
First download the SQLite Database Browser. It’s available as a free download on sourceforge. Once the SQLite Database Browser is on your system, you’ll be able to easily create and manage your SQLite databases.
Next, download the SQLite 3 binary
At this point, you should have something like this in a folder somewhere on your system:

Next either use SDB or the command line utility to create an SQLite database called “test.db”. Then run the generated SQL query on this database. This should create the table to store your Feedback object.

Once your database has been created, you should see that a file (test.db) has been created in your directory

All we need to do now is process the data that’s submitted from the feedback form, create a FEEDBACK object and Save it to the database.
This is the simplified code to process the data when the form is submitted:
$feedback->name = $_POST['name'];
$feedback->email = $_POST['email'];
$feedback->comment = $_POST['comment'];
if ($feedback->Save())
{
echo "feedback successfully saved";
}
A simple test to check if the feedback system works:


Note: MAKE SURE THAT YOUR SERVER HAS WRITE PERMISSION ON THE ENTIRE FOLDER SO THAT THE PHP SCRIPT CAN WRITE TO THE SQLITE DATABASE.
DOWNLOAD SOURCE FOR THIS TUTORIAL


