In the previous chapter, we added a global configuration file and configuration files per module. In order to be able to connect to a database, we need to add some lines to our configuration file first.
Let's recall our directory structure:
$ mysql -u YOURUSERNAME -p -e 'create database learning_phalcon;'
Open the global configuration file (
config/config.php), and add these lines:
'database' => array( 'adapter' => 'Mysql', 'host' => 'localhost', 'username' => 'Input your username here', 'password' => 'Input your password here', 'dbname' => 'learning_phalcon', ),
Now that we have the configuration parameters for our database, we must create a service. Open the global services file (
service.php) and add the following lines...