Warning: mssql_connect() [function.mssql-connect]: message: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. (severity 14) in \usr\local\htdocs\connect.php on line 5

We are using the following code for connectivity

mssql_connect('servername,port', 'username', 'password');
mssql_select_db("dbname");

You ARE changing those values to the proper ones, right? For example, to use the username "daniweb" and password "isthecurrentsite" and connect to the server www.example.com, your connection string would be:
mssql_connect('localhost', 'daniweb', 'isthecurrentsite');

I was facing the same type of error like [Warning: mssql_connect() [function.mssql-connect]: message: Login failed for user 'CORP\sanjsahu'. (severity 14) in D:\Program Files\xampp\htdocs\ on line 23
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: DTPXP-SANJSAHU\SQLEXPRESS in D:\Program Files\xampp\htdocs on line 23
Couldn’t connect to SQL Server on DTPXP-SANJSAHU\SQLEXPRESS]
while connecting through mssql.But some time it's working with the same user name and password and on the other time it throughs an exception like the abobe statement as described. Please let me know any permanent solution for that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.