Hello to all first of all.
This is Scorpionz. I am working on PHP OOPS these days, I am having a little problem in my Connection class, with Database.
Lets have a a look.
interface db
{
public function connect();
public function close();
public function error();
}
class mysqldb implements db
{
private $server;
private $username;
private $password;
private $dbname;
private $link;
public function connect($server,$username,$password)
{
$this->link=mysql_connect($server,$username,$password);
}
public function close()
{
return mysql_close($this->link);
}
public function error()
{
return mysql_error($this->link);
}
}
$MysqlDb = new mysqldb();
$MysqlDb->connect('localhost','root','');
I am having an error in this way:
Fatal error: Declaration of mysqldb::connect() must be compatible with that of db::connect() in C:\xampp\htdocs\sample_test\classes\config.php on line 10
I am unable to understand where am i wrong.
Any Response will be highly appreciated.
Thanks and Regards
Scorpionz.