I've been looking at this code for ages now and I cant really understand what it want from me. I keep getting the same error message no matter what I try and I've looked through other threads to no avail. The error is Fatal error: Call to a member function prepare() on a non-object in C:\wamp\www\new_serverside\sprint1.php on line 63. my code is :
<?php
include 'ConfigDB.php';
?>
<?php
if(getConnection())
{
echo "Server connection successful";
}
else
{
echo "Problem with connection";
}
ini_set('display_errors', 1);
global $dbh;
$query = $dbh->prepare("SELECT * FROM faculty");
$query->execute();
$result = $dbh->query($query);
foreach($result as $row)
{
echo $row['Name'] . "<br/>";
}
?>