You are missing
}
to finalize the class Database {
To avoid this, use proper line indention and follow the Zend Coding Style Guide
I don't know why I am having this error. I'm using WampServer. I am trying to configure my database thru OOP and I came up with this error.
Parse error: syntax error, unexpected '?>', expecting function (T_FUNCTION)
<?php
Class Database{
private $_host = null;
private $_user = null;
private $_pass = null;
private $_db = null;
var $con = false;
public function connects($host, $user, $pass, $db){
$this->_host = $host;
$this->_user = $user;
$this->_pass = $pass;
$this->_db = $db;
$this->con = mysql_connect($this->_host, $this->_user, $this->_pass);
if(!$this->con){
return false;
}
else{
$sql = mysql_select_db($this->_db);
if(!$sql){
return false;
}
else{
return true;
}
}
}
?>