Connecting to a sql server database with php
Posted on 2003-11-10
I have been forced to delve into php since last week largely, according to management, I have a solid asp background (which I do).
We have sql server db and management has no intention of switching to mySQL or any other db other than sql server.
They also want us to use apache server.
So I have installed, configured and tested apache server and everything seems ok so far.
I have also installed and configured php and it works.
I know it works because I tested with phpInfo and it displays all the info.
Right now, my biggest headache has been configuring php to allow connection to sql server db.
I have followed tons of articles from the web but I still cannot connect to the database.
Even a simple test such as this:
$myServer = "localhost";
$myUser = "sa";
$myPass = "";
$myDB = "Nort";
$s = @mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
$d = @mssql_select_db($myDB, $s)
or die("Couldn't open database $myDB");
does not work.
Notice that I deliberately entered wrong dbName = Nort for Northwind just to see if I get an error but I just returns a blank page.
I have changed error_status = "ON" still nothing.
Can someone, please, please help me get this configured correctly, please.