PHP Mysql database class error -
i don't know why having error. i'm using wampserver. trying configure database thru oop , came 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; } } } ?>
you missing
}
to finalize class database {
to avoid this, use proper line indention , follow zend coding style guide
Comments
Post a Comment