Re: SQL Server connection error.
| From: | Thomas Zibolowski | Date: | Sun, 08 Jun 2003 11:43:20 +0000 |
| Subject: | Re: SQL Server connection error. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-28428@lists.php.net to get a copy of this message | ||
Try using mssql
"Russell Roberts-Spears" <russellpocketpc@hotmail.com> schrieb im
Newsbeitrag news:Law14-F57tprR0E6faZ00008b92@hotmail.com...
> Hi,
>
> I am new to PHP DB code and am currently struggling with the connection to
> SQL Server 2000. I am using ODBC and have created a System DSN with
> integrated NT security specifiying which DB etc. I have written the
> following code and posted it in the htdocs folder for Apache. (We are all
> running on Win2000 platforms, Web server is set apart from the DB server,
> but linked via LAN.
>
> PHP code:
>
>
> <HEAD>
> <TITLE>ADODB Test in PHP</TITLE>
> </HEAD>
> <BODY>
> <?php
>
> // simple conection
>
>
> $cnx = odbc_connect('web', '', '');
> file://query
> $SQL_Exec_String = "select * from TblClients";
> file://ejecucion query
> $cur= odbc_exec( $cnx, $SQL_Exec_String );
> echo "<table
> border=1><tr><th>Dni</th><th>Nombre</th>".
> "<th>codigo</th><th>ciudad</th></tr>\n";
> while( odbc_fetch_row( $cur ) ) {
> $Title= odbc_result( $cur, 1 );
> $Fname= odbc_result( $cur, 2 );
> $Surname= odbc_result( $cur, 3 );
> $Address1= odbc_result( $cur, 4 );
> echo "<tr><td>$Title</td><td>$Fname</td>".
>
> "<td>$Surname</td><td>$Address1</td></tr>\n";
> }
> echo "</table>";
>
> ?>
> </BODY>
> </HTML>
>
> ////////////////////////////////
>
>
> I then get back the following error:
>
>
>
> Warning: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Login
> failed for user 'PROTE\LATTITUDWEBSERV$'., SQL state 28000 in SQLConnect
in
> C:\Apache\Apache2\htdocs\DBtest.php on line 9
>
> Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource
in
> C:\Apache\Apache2\htdocs\DBtest.php on line 10
> DATA FROM SQL SERVER WITH PHP4 Cand_ID Password
>
> Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result
> resource in C:\Apache\Apache2\htdocs\DBtest.php on line 14
>
>
>
> Am at a loss as to why the error. Have created another DSN in same system
> which links in using VB to the same SQL Server using the same NT
integrated
> security and it is fine, so I am a little perplexed.
>
> Any help or pointers would be gratefully received
>
>
> Best regards
>
>
>
> Russell
>
> _________________________________________________________________
> Stay in touch with absent friends - get MSN Messenger
> http://www.msn.co.uk/messenger
>