My favorites | Sign in
Project Logo
             
Search
for
Updated Oct 30, 2008 by tewolde
Labels: Featured
CreatingTableObjects  

Creating Table Objects

Introduction

Steps to creating a table object out of your database table or view. This example connects to a mysql database animal_db and constructs a table object from the tbl_animals table.

Details

Create an mdb2 object

require_once "MDB2.php";

$dsn     = 'mysql://username:pass@localhost/animal_db';
$mdb2 = MDB2::singleton($dsn);

Load the TableBrowser module

$mdb2->loadModule('TableBrowser');

Create the table object Create a table browser for the tbl_animals table, and specify id as the primary key

$browser = $mdb2->tableBrowserFactory('tbl_animals', 'id');

Sign in to add a comment
Hosted by Google Code