So I’ve found a method which looked nice to me: http://www.php.net/manual/en/class.pdo.php#97682
Requires PHP 5.3 but my host only supports 5.2 🙁
So what method should I use for PDO, where it only connects to the database when needed?
And reuses the same connection?
Use a procedural singleton for readability:
This simplifies the use to for example: