DIDS-Coursework/DIS-COMP4039-CW2-psxrp11-20450011/psxrp11-20450011_InstallationFiles/config.php

21 lines
460 B
PHP
Raw Permalink Normal View History

<?php
/**
* Create database connection
* @return PDO|string - Database connection or error message
*/
function dbConn()
{
$host = "mysql.cs.nott.ac.uk";
$dbName = "psxrp11_dbcw";
$username = "psxrp11_dbcw";
$password = "B4nking£ma1lC!tys";
try
{
return new PDO("mysql:host=$host;dbname=$dbName", $username, $password);
}
catch (PDOException $e)
{
return "Connection failed: " . $e->getMessage();
}
}