• CONTEST ALERT - Experience the power of DDR5 memory with Kingston Click for details

PHP ODBC Connection failed , Sql Server 2000, help

Status
Not open for further replies.

Butterfly

Broken In
Folks ,

AM trying to make connection with the Northwind database(SQL server 2000 usiung PHP but i get this error . Help me , am begineer

***********************************************************
Warning: odbc_connect(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection., SQL state 28000 in SQLConnect in c:\web\odbc_connection.php on line 2
Connection Failed:

**********************************************************

************************************This is my code *********
<html><body><?php
$conn=odbc_connect('northwind','','');
if (!$conn)
{
exit("Connection Failed: " . $conn);
} $sql="SELECT * FROM customers"; $rs=odbc_exec($conn,$sql); if (!$rs)
{ exit("Error in SQL");
} echo "<table><tr>";echo "<th>Companyname</th>";
echo "<th>Contactname</th></tr>";while (odbc_fetch_row($rs))
{$compname=odbc_result($rs,"CompanyName");$conname=odbc_result($rs,"ContactName");echo "<tr><td>$compname</td>";echo "<td>$conname</td></tr>";}
odbc_close($conn);echo "</table>";?></body></html>
 

#/bin/sh

Journeyman
$conn=odbc_connect('northwind','','');

needs to contain your user name and password i belive like...

$conn=odbc_connect('northwind','$USERNAME','$PASSWORD'); (assuming i don't have that backwards)

Good Luck!
 

GNUrag

FooBar Guy
Nope... he did'nt create a DSN... i talked to him on messenger... Did you succeed in creating a Data Source ?
 

Deep

Version 2.0
#/bin/sh said:
$conn=odbc_connect('northwind','','');

needs to contain your user name and password i belive like...

$conn=odbc_connect('northwind','$USERNAME','$PASSWORD'); (assuming i don't have that backwards)

yup i too think, that could be the problem...

Deep
 
OP
B

Butterfly

Broken In
Guys < Thanks My ODBC Connection worked

Folks

Yeah my connection part worked , am so happy , catch ya latter
 
Status
Not open for further replies.
Top Bottom