Phalcon Connecting to Database

We connect the front-end with the backend i.e. database. To access the database we required username and password. Below we connect to the database name: javatpoint and defining configuration file.

Example

  <?php  

  

// Required  

$config = [  

    'host'     => '127.0.0.1',  

  

// Optional  

$config['persistent'] = false;  

  

// Create a connection  

$connection = new \Phalcon\Db\Adapter\Pdo\Mysql($config);  

    'username' =>'siddharth',  

    'password' =>'flash',  

    'dbname'   => 'javatpoint',  

];  

    Output:

    Phalcon Connecting To Database 1

    Comments

    Leave a Reply

    Your email address will not be published. Required fields are marked *