The.Anti.9
The.Anti.9

Reputation: 44738

PHP and SQL Server debugging

I'm working on a script in PHP that needs to get some info from a SQL Server database. However, I am having trouble connecting to the database. When i use the mssql_connect() function, it gives me an error and says it cannot connect to the database. However, it gives no reason why. Is there any way to find out why it won't connect? There doesn't seem to be a function mssql_error() or anything like there is with the mysql library.

Upvotes: 1

Views: 1204

Answers (4)

tchalvak
tchalvak

Reputation:

Definately move to PDO, you'll get more benefit in the long run when you want more features in the future.

Upvotes: 0

Justin Yost
Justin Yost

Reputation: 2340

I would check your settings for the PHP MSSQL extension, I once had Security enabled and needed it off to access a particular MSSQL server.

Upvotes: 0

chris
chris

Reputation: 120

Try to use pdo (http://php.net/pdo). the mssql-extension is a mess.

Instead of '' it returns ' ' for empty strings. It seems to be a bug in ntwdblib that has never been fixed. When I experienced the problem i nearly went crazy...

To get the client connected: Have you activated tcp/ip on the sql-server? On MSSQL 2005 Express it's not activated by default!

Upvotes: 2

Rob Prouse
Rob Prouse

Reputation: 22657

Have you tried looking in the Windows Event Log? I am not sure if there will be enough info there, but it may help.

Upvotes: 0

Related Questions