Problem connecting to MSSQL database

I am currenty unable to connect to a MS SQL Express 2012 database using the grid connector. From what I can tell, the grid_connector.php and db_mssql.php files are not the problem. The following is my php code:

<?php require("../xml/grid_connector.php"); require("../connector_codebase/db_mssql.php"); $res=mssql_connect('.\SQLEXPRESS',"sa","mark",false); mssql_select_db("Grid"); $gridConn = new GridConnector($res,"MsSQL"); $gridConn->render_table("dbo.Quotes","Id","Quote,ProjectName,PM"); ?>

I appreciate any assistance you can offer.


If you are using latest PHP driver from Microsoft, you need to use db_sqlsrv.php not db_mssql.php and connect to DB like


$connectionInfo = array( “Database”=>“dbName”);
$conn = sqlsrv_connect( $serverName, $connectionInfo);

$gridConn = new GridConnector($conn,“SQLSrv”);[/code]

Also, beware that Express edition of MsSQL do not allow login for “sa” user by default, it need to be enabled in server configuration.

Thank you! This code worked great! I also discovered I needed to add the native client and update my php.ini file. Now, I’m up and running.