Hello,
Why is this code giving me an error?
<?
class PGDB {
public $conn;
public $result;
public $row;
public $query;
public $recordcount;
public function setConn($status)
{
if ($status==0) {//if you want connect
$this->conn=pg_Connect ("host=localhost port=5432 dbname=test user=test password=test")or die("can not connect the Server");
}
else {
pg_freeresult($this->result);
return pg_close($this->conn);/log off connection/
}
}
}
// connect database
$this = new PGDB; //Line 22
$this->setConn(0);
?>
the above give the error:
Fatal error: Cannot re-assign $this in /home/test/public_html/test.php on line 22
Thanks,
pornprapa