|
Creating Table Objects IntroductionSteps 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. DetailsCreate 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');
|