<?php
$db_hostname = 'localhost';
$db_database = 'me21abc_xxx'; //'Your database name'
$db_username = 'me21abc_xxx'; //'your username';
$db_password = 'xxxxxxx'; //'Your password';
$db_connection_string = "mysql:host=$db_hostname;dbname=$db_database";
$db_status = 'not initialised';
$content = '';
try {
//create a connection object
$conn = new PDO($db_connection_string, $db_username, $db_password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db_status = "Connected successfully";
} catch(PDOException $e) {
$db_status = "Connection failed: " . $e->getMessage();
}
// Close connection to database
$conn = null;
?>
<!DOCTYPE html>
<html>
<head>
<title>Using Data</title>
</head>
<body>
<h1>Using data...</h1>
<h4>Sales/plays per month to make minimum wage</h4>
<p>
Database <?php echo $db_database; ?>...
<strong><?php echo $db_status; ?></strong>
</p>
<!-- This is where our data will be printed out: -->
<?php echo $content; ?>
<p><em>Data from <a href='http://www.informationisbeautiful.net/'>
InformationIsBeautiful.net</a></em></p>
</body>
</html>