<?php
class MyModule {

    
// The module will be accessible at http://yourdomain.com/User/MyModule
    
function user_area() {
        global 
$billic$db;
    
        
// Get a single row from the `users` table
        
$user $db->q('SELECT * FROM `users` WHERE `email` = ?''john.doe@example.org');
        
$user $user[0];
        if (empty(
$user)) {
            die(
'User not found');
        }

        
// Get a single row with more than one WHERE variable
        
$user $db->q('SELECT * FROM `users` WHERE `email` = ? AND `name` = ?''john.doe@example.org''John');
        
$user $user[0];
        if (empty(
$user)) {
            die(
'User not found');
        }

        
// get multiple rows from a table
        
$users $db->q('SELECT * FROM `users` WHERE `id` < ?'50);
        if (empty(
$users)) {
            die(
'No users found');
        }
        foreach(
$users as $user) {
            echo 
'<pre>';
            
var_dump($user);
            echo 
'</pre><br>';
        }

        
// insert a row into a table
        
$id $db->insert('users', array(
            
'email' => 'john.doe@example.org',
            
'firstname' => 'John',
            
'lastname' => 'Doe',
            
'country' => 'US'// 2 letter country code
        
));
        echo 
'Inserted row with ID '.$id;
    }
}
?>