Hey All,

I've been developing a PHP / MySQL database-driven website locally on XAMPP. Everything works perfectly fine and as expected, so, with some data in the database I decided it was time to finally upload the website files and DB to my web host MediaTemple on the Grid-Server service.

Unfortunately the PHP isn't connecting to the MySQL DB, for some reason.

Please see the following database-driven PHP pages which aren't connecting to the MySQL DB:

http://huffier.com/library/
http://huffier.com/library/title/?slug=dracula
http://huffier.com/library/read/?slu...ula&pageSlug=1

As you can see from the links - No error messages and also no data from the MySQL DB either. My DB connection is as follows (the details aren't the real details, but they are correct when they are the real details):

PHP Code:
<?php
try
{
$pdo = new PDO('mysql:host=internal-db.s00000.gridserver.com;dbname=db00000_huffier''db00000''password');
$pdo->setAttribute(PDO::ATTR_ERRMODEPDO::ERRMODE_EXCEPTION);
$pdo->exec('SET NAMES "utf8"');
}
catch (
PDOException $e)
{
$output 'Unable to connect to the database server.';
include 
'error.html.php';
exit();
}
The (mt) support guy tested the connection with an mttest database user without error and found that the database server itself is working and accepting connections. He also mentioned that the DB connection script that I've pasted above was configured correctly so this is likely not an issue, which means it must be something to do with the other PHP files I've got.

This index.php file is located in the "library" folder:

PHP Code:
<?php

include $_SERVER['DOCUMENT_ROOT'] . '/includes/dbconnection.inc.php';

try
{
    
$sql 'SELECT bookTitle, bookSlugName FROM books';
    
$result $pdo->query($sql);
}
catch (
PDOException $e)
{
    
$error 'Error fetching books: ' $e->getMessage();
    include 
'error.html.php';
    exit();
}

foreach (
$result as $row)
{
    
$books[] = array(
    
'name' => $row['bookTitle'],
    
'slug' => $row['bookSlugName']
);
}

include 
'library.html.php';
?>
And this is the library.html.php file, also located in the "library" folder:

HTML Code:
<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/huffier.com/includes/helpers.inc.php'; ?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta name="description" content="Browse through all of the eBook titles available in the Huffier digital library on this page.">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>Library &ndash; Huffier</title>
		<base href="http://www.huffier.com/"/>
		<!--[if lt IE 9]>
		<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
		<![endif]-->
		<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
		<link rel="stylesheet" media="screen" href="../css/stylesheet.css">
	</head>
	
	<body>
		<?php include_once("../analyticstracking.php") ?>

		<nav>
			<?php include_once("../includes/nav.php") ?>
		</nav>

		<article>
			<header>
				<h1>Library</h1>
			</header>
			
			<div id="content">
				<ul id="title-listing">
					<?php foreach ($books as $book): ?>
					<li>
						<a href="title/?slug=<?php htmlout($book['slug']); ?>">
						<img src="../images/covers/<?php htmlout($book['slug']); ?>.png" alt="<?php htmlout($book['name']); ?>"/>
						</a>
					</li>
					<?php endforeach; ?>
				</ul>

			</div>
		</article>
	</body>
</html>
And the "error.php" files, also located in the "library" folder just replaces the PHP containers in the "library.html.php" file with <?php echo error; ?>.

Any bright ideas as to what has gone woefully wrong with my scripting?

Any pointers in the right direction (or a solution) would be greatly appreciated!

Thanks!