Basically you want only one connection to the db. The responsibility for connecting to and "talking" with the db should not be shared among many classes. You'll have to copy-paste host, username, password information, which will be quite bad, when you move your site around, and you have to hunt down all instances of connecting to the database and rewrite it. Pretty baaad.
So, my advice: login related functionality goes in Login class, DB related in DataBaseHandler class, formatting HTML in its own class, etc.
Example for DataBaseHandler:
DataBaseHandler.php:
class DataBaseHandler
{
private $mysql_host = "myhost.example.com";
....
function Connect()
{
$this->mysqli_object = mysqli_connect($this->mysql_host, $this->mysql_username, $this->mysql_password, $this->mysql_db);
if ($this->mysqli_object->connect_errno)
{
print "Failed to connect to MySQL: " . $this->mysqli_object->connect_error;
}
}
....
}
$dbHandler = new DataBaseHandler;
$dbHandler->Connect();
If you end up writing mySqlObject->connect(...)
-s everywhere, you will be making a lot of work for yourself.
Update (regarding the comment)
The way I used it (probably not the best practice, since I had stopped writing php years ago) was I included the file of the class everywhere I needed. But you can ask around what's the best practice for that (static? global? composition???) in php. (In the simplest case in C# I would go for a lazy evaluated singleton, probably :))