> I could suggest a number of ways around the if/else construct, such as
> creating a subclass for the various servers with a uniform interface
> and hiding the differences inside the class.
This, but I'd prefer using one of the already available abstractions for PHP:
- PDO: http://www.php.net/PDO
- DB: http://pear.php.net/package/DB
- MDB2: http://pear.php.net/package/MDB2
- DBAL: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/
... let's not re-re-reinvent the wheel ;)
I would also highly recommend NOT using the mysql extension anymore in PHP for
new projects. Use mysqli (mysql Improved) or PDO_MySQL. Also, learn to love
prepared statements.
--
Rik Wasmus