I keep getting

Code:
Fatal error: Call to a member function prepare() on a non-object in /var/www/auto/functions.php on line 72
for the following but i have checked all post variables all are being passed.

Can any one spot my error?!


PHP Code:
function add_device ($devicename,$devicebrand,$deviceremoteid,$devicechannel) {
GLOBAL 
$dbh;
$insertdev$dbh->prepare("INSERT INTO `devices` (`name`, `brand`, `remoteid`, `channel`) VALUES (:name, :brand, :remote, :channel)");
$insertdev->bindParam(':name'$devicename);
$insertdev->bindParam(':brand'$devicebrand);
$insertdev->bindParam(':remote'$deviceremoteid);
$insertdev->bindParam(':channel'$devicechannel);
$insertdev->execute();
echo 
"<br><b>Device Added to Database</b><br />";