You can use the mySqli or PDO but I would suggest using PDO because it offers exceptions where you can put it in try catch. PHP Data Objects is included with PHP 5.1, provides OOP interface. It also provides a consistent interface that's portable between other database servers such as Oracle, DB2, MS SQL Server, and PostgreSQL. The code looks like this,
Code:
try {
$db = new PDO($dsn, $username, $password, $options);
}catch (PDOExceptions $e) {
$error_message = $e->getMessage();
exit;
}
Where your $dsn should look like this "sqlsrv:server=hostname_or_ip;Database=database_na me;"
As for the "$options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);"
Hope this help...