In MVC type architecture, is it safe to do this
ini_set("mysql.default_host"$mysql_host);
ini_set("mysql.default_user",$mysql_user);
ini_set("mysql.default_password",$mysql_pass);
in my index.php file.
Then, every time time I do a query in a model,
mysql_connect(); // MySQL connects using the default values from the ini_sets we did.
mysql_query($query);
mysql_close();
The reason behind this, would be to avoid passing database variables to objects/models etc or defining constants.
Maybe there's a better way? I'm looking into database abstraction.