| 
<?phpheader("Content-type: text/plain; charset=UTF-8");
 require_once "classes/autoload.php";
 use com\soloproyectos\common\db\DbConnector;
 use com\soloproyectos\common\db\DbDataSource;
 use com\soloproyectos\common\db\DbTable;
 
 $db = new DbConnector("database", "username", "password");
 
 // updates the record "content.id = 101"
 $t = new DbTable($db, "content", 101);
 $t->set("description", "Record description...");
 $t->set("image.path", "/path/to/image.jpg");
 $t->set("video.path", "/path/to/video.mp4");
 $t->set("file.path", "/path/to/file.pdf");
 $t->update();
 
 // inserts a new record
 $t = new DbTable($db, "content");
 $t->set("description", "Record description...");
 $t->set("image.path", "/path/to/image.jpg");
 $t->set("video.path", "/path/to/video.mp4");
 $t->set("file.path", "/path/to/file.pdf");
 $t->insert();
 
 // deletes the record "content.id = 101"
 $t = new DbTable($db, "content", 101);
 $t->delete();
 
 // prints info from the record "content.id = 101"
 $t = new DbTable($db, "content", 101);
 $t->get("description");
 $t->get("image.path");
 $t->get("video.path");
 $t->get("file.path");
 
 // loops through the records of the table "content"
 $t = new DbTable($db, "content");
 $t->setOrder("id desc");
 $t->setFilter("section_id = 'blah'");
 foreach ($t as $row) {
 // updates the record
 $row->set("description", "New description");
 $row->set("image.path", "/path/to/new/image.jpg");
 $row->update();
 
 // prints some info
 echo "Description: " . $row->get("description") . "\n";
 echo "Image: " . $row->get("image.path") . "\n";
 echo "Video: " . $row->get("video.path") . "\n";
 echo "File: " . $row->get("file.path") . "\n";
 }
 
 |