I need to create a class for connection to the DB. I know that hardcoding DB info is bad such as:
$user = "xxx";
$password = "yyy";
$server = "zzz";
$dbname = "name";
mysql_connect($user,$password,$server);
mysql_select_db($dbname);
That's why i use "include" such as:
include "config.php"
which contains all the needed variables, and then I can use mysql_connect with them. But as far as i know, this is a bad practice as well. How can I use the mysqli class (extending it?) the easiest way, and ofcourse the safest possible?
Thanks for any tip