Files
WebDB/website/queries/connect.php
2017-01-18 10:43:54 +01:00

11 lines
350 B
PHP

<?php
$dbconf = simplexml_load_file("/var/mysql_config.xml");
if ($dbconf === FALSE) {
die("Error parsing XML file");
}
else {
$GLOBALS["db"] = new PDO("mysql:host=$dbconf->mysql_host;dbname=$dbconf->mysql_database;charset=utf8",
"$dbconf->mysql_username", "$dbconf->mysql_password")
or die('Error connecting to mysql server');
}