I have the following code:
class db {
//database class, connects and closes a database connection
//some properties and methods are hided (such as host-adres, username...)
public function connect()
{
mysql_connect(//parameters)or die(mysql_error());
}
}
class ban {
//ban class, bans an ip, again some methods and properties are hided
public function banIP()
{
//here i want to access the connect function of the class db,
//without creating a object.
//some code
}
}
Now my question, from inside the method banIP() i need to connect to the database, using the function connect() from class db. But how do I access the connect function?