error_reporting(E_ALL);
ini_set("display_errors", 1);
- // database config.
- $host = "localhost";
- $dbname = "guestbook";
- $username = "";
- $password = "";
+ // load database config
+ $config = parse_ini_file(__DIR__ . '/../config/config.ini', true);
+
+ $host = $config['database']['host'];
+ $username = $config['database']['username'];
+ $password = $config['database']['password'];
+ $dbname = $config['database']['dbname'];
// connect to database
$conn = new mysqli($host, $username, $password, $dbname);