PDA

View Full Version : Does php support MS SQL Server?


lc1200
04-06-2006, 02:51 AM
I have a site that uses asp.net 2.0 and sql server 2005. I tried to connect using php and mssql_conect functions but I get an error :Fatal error: Call to undefined function: mssql_connect() .....

Does php hereat discountasphave the mssql functions installed?

bruce
04-06-2006, 05:33 AM
mssql_connect is not supported.

You'll have to use ODBC_connect

Bruce

DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)

jorgece
05-26-2006, 03:31 AM
Hi,

I have never used ODBC , but found some directions in the web.

Seem like the connection has to be made as follows:

# connect to a DSN "mydb"
$connect = odbc_connect("mydb", "user", "passwd");

And from the KB:

DSN="SQLDSN_sqlConn";
$DSN_User="sqlusername";
$DSN_Passwd="sqlpassword";
$QueryString="SELECT id, FirstName, LastName, Email FROM tblContact";

$Connect = odbc_connect( $DSN, $DSN_User, $DSN_Passwd );
$Result = odbc_exec( $Connect, $QueryString );


Now, the issue here is that the SQL server I'm trying to connect to is not local.
Where do I specify the location (IP number) ?

F

TIA

bruce
05-26-2006, 09:09 AM
use the complete connection string as the 1st variable in the odbc_connect command

eg.

odbc_connect('DRIVER={SQL Server};SERVER=<serverName>;DATABASE=<database_name>', '<DBUser>', '<DBPassword>')

Bruce

DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)

tsuchan
12-26-2006, 08:03 AM
Yes, odbc_connect() can work, of course. But you are a company which is charging as much for a specifically MS SQL 2000 database connection as for the hosting itself... why would you not support mssql_connect() ?

If you think that one is as good as the other, please bear in mind that developers, like ourselves, have an end-client; and we're trying to build a system to their specifications... to run on their architecture. Discountasp.net are providing our development environment, because the client wanted a specific environment we can't provide in-house. But your service loses value value every time we can't develop and test what they've asked for, and have to make a workaround.

Straight-up, it would be really useful to have a page with an exhaustive list of things you don't support, in your knowledgebase.