Search Results

Search found 1 results on 1 pages for 'user203708'.

Page 1/1 | 1 

  • MySQL or SQL Server

    - by user203708
    I'm creating an application that I want to run on either MySQL or SQL Server (not both at the same time) I've created two PHP classes DatabaseMySQL and DatabaseSQLSVR and I'd like my application to know which database class to use based on a constant set up at install. define(DB_TYPE, "mysql"); // or "sqlsrv" I'm trying to think of the best way to handle this. My thought is to do an "if else" wherever I instantiate the database: $db = (DB_TYPE == "mysql") ? new DatabaseMySQL : new DatabaseSQLSVR; I know there has to be a better way of doing this though. Suppose I want to add a third database type later; I'll have to go and redo all my code. Yuk!! Any help would be much appreciated. Thank

    Read the article

1