<?php
    $db_hostname = 'localhost';
    $db_database = 'me21zs_UsingData'; //'Your database name'
    $db_username = 'me21zs_me21zs'; //'your username';
    $db_password = 'Str4ppini'; //'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>