OOPHP + Relational MySQL DB

ok so I am trying to follow the two tutorials by BWH2 (hes best bet at helping) and have got this so far as my php code, I have changed some stuff from both tutorials though:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PHP Files and Projects</title>
</head>

<body>
<?php
mysql_connect($_ENV['DATABASE_SERVER'], 'username', 'password');
mysql_select_db('database');
$query = "SELECT * FROM tbl_works";
$result = mysql_query($query);
$num = mysql_num_rows($result);
if (!$result) {
$message  = 'Invalid query: ' . mysql_error() . "
";
$message .= 'Whole query: ' . $query;
die($message);
}
$ids = array();
$i=0;
while ($i < $num) {
$work_id=mysql_result($result,$i,'work_id');
array_push($ids, $work_id);
$i++;
}

foreach ($ids as $newid) {
$$newid = new project($newid);
}
mysql_free_result($result);
echo $1->getID();
class project {
    private $id;
    private $title;
    private $description;
    private $category;
    private $imageurl;
    function setID($val) {
        $this->id = $val;
        return;
    }
    function getID() {
        return $this->id;
    }
    function getTitle() {
        return $this->title;
    }
    function __construct($val) {
        $this->id = $val;
    }
}
mysql_close();
?>
</body>
</html>

But everytime I run that I get:

Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or ‘$’ in /home/5900/domains/php.digitalcarnival.com/html/index.php on line **32

**P.S. I have changed my password, username and database but they are correct