note 51953 added to ref.mssql

From: Date: Sat, 16 Apr 2005 17:28:11 +0000
Subject: note 51953 added to ref.mssql
Groups: php.notes 
Request: Send a blank email to php-notes+get-88087@lists.php.net to get a copy of this message
Frustrated: Win2003 Server, SQL Server, PHP 5, all on the same machine. Here is my code: <? $server="localhost"; $username="username"; $password="password"; $sqlconnect=mssql_connect($server, $username, $password); $sqldb=mssql_select_db("Northwind",$sqlconnect) or DIE("DATABASE FAILED TO RESPOND."); $sqlquery="SELECT companyName FROM Customers;"; $results= mssql_query($sqlquery); while ($row=mssql_fetch_array($results)){ echo $row['companyName']."<br>\n";} mssql_close($sqlconnect); ?> Here is my error: Warning: mssql_connect() [function.mssql-connect]: message: Login failed for user 'INNOVATIVE\IUSR_INNOVATIVE1'. (severity 14) in E:\Websites\RealEstate(dons)\dbtest3.php on line 5 I have tried many variations of the above code, including adding the port# (even though this should be unnecessary with everything residing on the same box), creating different user names inside of SQL Server (not only users for a particular database but for the entire server under security.) I have checked the ntwdblib.dll and made sure it was in the right place, i have checked the php.ini file till my face is blue. I do successfully connect using odbc like this: <? $dsn="RealEstateTool"; $username="username"; $password="password"; $sqlconnect=odbc_connect($dsn,$username,$password); $sqlquery="SELECT companyname FROM Customers;"; $process=odbc_exec($sqlconnect, $sqlquery); while(odbc_fetch_row($process)){ $companyName = odbc_result($process,"companyName"); echo "$companyName<br>"; } odbc_close($sqlconnect); ?> I have also set up multiple DSN's on the server. Any help would be greatly appreciated. ---- Manual Page -- http://www.php.net/manual/en/ref.mssql.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51953 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51953&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51953&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51953&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51953&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51953&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51953&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#88087) next »