21 lines
460 B
PHP
21 lines
460 B
PHP
|
<?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();
|
||
|
}
|
||
|
}
|