Location: PHPKode > scripts > phpEngine > phpengine/addons.php
<?php

/*************************************************************************

MYSQL ADDON

mysql> CREATE DATABASE phpengine;
mysql> USE phpengine;
mysql> CREATE TABLE countries (
    -> timestamp int(10) default 0,
    -> country varchar(15) default NULL,
    -> capital varchar(15) default NULL
    -> );
mysql> INSERT INTO countries VALUES (1072908000, 'Lithuania', 'Vilnius');
mysql> INSERT INTO countries VALUES (1076796000, 'Poland', 'Warsaw');
mysql> INSERT INTO countries VALUES (1078178400, 'Germany', 'Berlin');
mysql> INSERT INTO countries VALUES (1079733600, 'France', 'Paris');
mysql> INSERT INTO countries VALUES (1080939600, 'Netherlands', 'Amsterdam');
mysql> INSERT INTO countries VALUES (1081544400, 'England', 'London');
mysql> INSERT INTO countries VALUES (1082840400, 'Belgium', 'Brussels');
mysql> INSERT INTO countries VALUES (1085000400, 'Switzerland', 'Bern');
mysql> INSERT INTO countries VALUES (1086296400, 'Spain', 'Madrid');
mysql> INSERT INTO countries VALUES (1087938000, 'Portugal', 'Lisbon');
mysql> SELECT * FROM countries;
+------------+-------------+-----------+
| timestamp  | country     | capital   |
+------------+-------------+-----------+
| 1080939600 | Netherlands | Amsterdam |
| 1072908000 | Lithuania   | Vilnius   |
| 1076796000 | Poland      | Warsaw    |
| 1078178400 | Germany     | Berlin    |
| 1079733600 | France      | Paris     |
| 1081544400 | England     | London    |
| 1082840400 | Belgium     | Brussels  |
| 1085000400 | Switzerland | Bern      |
| 1086296400 | Spain       | Madrid    |
| 1087938000 | Portugal    | Lisbon    |
+------------+-------------+-----------+
10 rows in set (0.00 sec)

**************************************************************************/

require_once("phpEngine_run-up-1.1.2.php");

$e =& new phpEngine;

$e->addon("mysql");
$e->mysql->connect("phpengine");

$sql = "SELECT * FROM countries";
$loop = $e->mysql->fetch($sql);

$e->assign("loop_name", $loop, "date, country, capital");

$e->output("thisisonlyanothertest.pat", true);

?>
Return current item: phpEngine