Question: I am just a newbie in cakephp and struggled a lot as a beginner, I hope im not exaggerating. I believe I was on the right track of coding a simple registration application when I found out that I am not able to insert any data in my database. The name of my database is "cake" and this is the default configuration:

```
public $default = array{
    'datasource'=>'Database/Mysql',
    'persistent'=>false,
    'host'=>'localhost',
    'login'=>'root',
    'password'=>'',
    'database'=>'cake',
    'schema'=>'',
    'prefix'=>''
}

```

By the way, the index page of my localhost says that I am connected to the database.

Answer: 
You still have to save the username and password to session. but dont save password in clear text , use openssl\_encrypt and openssl\_decrypt with your own hash.

<http://php.net/manual/en/function.openssl-encrypt.php>

but this function appears from PHP 5.3.0 above
No, don't make your application one giant file.

Put your DB credentials in an include outside of the web root. Then, make sure only the users that need it can open it. That's how this is generally done.