RE: How to connect to MS SQL
Posted: Thu Dec 05, 2002 1:26 pm
One thing you will find is that if you are using SQL Server 2000 you cannot use the existing MS SQL function in PHP. They will only work with SQL Server 7 I have found. What I suggest is using the unified ODBC driver and related functions...ie
Of course this requires setting up a system dsn pointing to a specific database.
If you are on unix/linux box connecting to mssql it can be a pain, because you cant set up a dsn, but you have to mimic it with system variables. I am sure there is some documentation on how to do that, but I dont have time to look it up.
Code: Select all
$conn = odbc_connect($dsn, $username, $password);
$RS = odbc_exec($conn, "select * from table");If you are on unix/linux box connecting to mssql it can be a pain, because you cant set up a dsn, but you have to mimic it with system variables. I am sure there is some documentation on how to do that, but I dont have time to look it up.