
- 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
Examples: User registration system
Let’s assume we want to create a registration system which will store the following:
- a username
- a password
- user’s first name
- user’s last name
- user’s email address
Use the list of attributes above to generate the User object for PHP 4 and download the zip file.
Then, unzip the contents and rename the object file to class.user.php. At this point, this is what you should have in a folder somewhere on your system
Next, open class.user.php file, and in the header region, you should find the SQL query to create the table needed by your object. Once your table is created, open the configuration file and edit it so that the wrapper can connect to your database.
Now, let’s assume you already have a web registration form (see index.html). If you look at the source code for the web form, you’ll find 6 inputs:
- username
- password1
- password2
- firstname
- lastname
- emailaddress
All we need to do now is process the data that’s submitted from the form, create a USER object and Save it to the database.
This is the simplified code to process the data when the form is submitted:
$user->userName = $_POST['username'];
if ($_POST['password1'] == $_POST['$password2'])
{
$user->password = $_POST['password1'];
}
$user->firstName = $_POST['firstname'];
$user->lastName= $_POST['lastname'];
$user->emailAddress= $_POST['emailaddress'];
if ($user->Save())
{
echo "user successfully saved";
}
DOWNLOAD SOURCE FOR THIS TUTORIAL