Hi naveengujri,
Phalcon works with the MVC pattern, meaning that almost everything you'll do to interact with databases will happen in the "Model".
Just setup your connection in index.php, for example:
// Setup the database component.
$di->set('db', function() use ($config) {
// Create connection.
$connection = new \Phalcon\Db\Adapter\Pdo\Mysql(array(
"host" => $config->database->host,
"username" => $config->database->username,
"password" => $config->database->password,
"dbname" => $config->database->dbname,
'persistant' => $config->database->persistant,
'charset' =>'utf8'
));
// Return connection.
return $connection;
});
Then create your models, you can read more about them here: https://docs.phalcon.io/en/latest/reference/models.html
You than have access to several CRUD methods, for example ->save(), ->find(), ->findFirst(), ->delete(), etc. on your model.
Hope this helps!