Not a big deal in Orchid. If u have a table named “users” in your mysql database with the following structure, you can interact with it like this.

CREATE TABLE `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(250) DEFAULT NULL,
  `password` varchar(32) DEFAULT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM

Here is how to interact using a model

$usersmodel = $this->model->users;
$usersmodel->username = "test";
$usersmodel->password = "testpass";
$usersmodel->insert();
 
$usersmodel->find("username = 'test'");
$usersmodel->username = "tester";
$usersmodel->update();

You dont need to write any code for this model “users”. It is auto generated using the active record library that comes with orchid. You can generate models by naming them same as table names in your database. Easy, huh?