Forum     

Go Back   Digit Technology Discussion Forum > Portables, Peripherals and Electronics > QnA (read only)
Register FAQ Calendar Mark Forums Read

QnA (read only) Mods please help transfer the contents of this forum to proper sections. :)


 
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-10-2004, 09:36 PM   #1 (permalink)
Apprentice
 
Join Date: Sep 2004
Location: Thimphu
Posts: 87
Default PHP ODBC Connection failed , Sql Server 2000, help


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>
__________________
Flip like a butterfly, sting like a bee
Butterfly is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 02-10-2004, 12:10 AM   #2 (permalink)
Broken In
 
Join Date: Aug 2004
Posts: 190
Default

did u create a dsn
i thnk thats the problem
__________________
Attack life, it\'s going to kill you anyway.
walking-techie is offline  
Old 02-10-2004, 02:04 AM   #3 (permalink)
In The Zone
 
#/bin/sh's Avatar
 
Join Date: Apr 2004
Location: 42.65 N 73.76 W
Posts: 213
Default

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

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

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

Good Luck!
__________________
\"99 little bugs in the code, 99 bugs in the code, fix one bug, compile it again, 148 little bugs in the code. 148 little bugs in the code....\"
#/bin/sh is offline  
Old 02-10-2004, 11:22 AM   #4 (permalink)
FooBar Guy
 
GNUrag's Avatar
 
Join Date: Jun 2004
Location: GNUmbai
Posts: 1,245
Default

Nope... he did'nt create a DSN... i talked to him on messenger... Did you succeed in creating a Data Source ?
__________________
- --
http://web.gnuer.org
GNUrag is offline  
Old 02-10-2004, 10:19 PM   #5 (permalink)
Version 2.0
 
Deep's Avatar
 
Join Date: Jan 2004
Location: Mumbai
Posts: 977
Default

Quote:
Originally Posted by #/bin/sh
$conn=odbc_connect('northwind','','');

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

$conn=odbc_connect('northwind','$USERNAME','$PASSW ORD'); (assuming i don't have that backwards)
yup i too think, that could be the problem...

Deep
__________________
- Deep Ganatra -
www.whoisdeep.com
www.twitter.com/DeepXP/
Deep is offline  
Old 03-10-2004, 09:55 PM   #6 (permalink)
Apprentice
 
Join Date: Sep 2004
Location: Thimphu
Posts: 87
Default Guys < Thanks My ODBC Connection worked

Folks

Yeah my connection part worked , am so happy , catch ya latter
__________________
Flip like a butterfly, sting like a bee
Butterfly is offline  
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Sujeet
- by clinton
- by Who
- by bhaskar
- by soumya

Advertisement




All times are GMT +5.5. The time now is 11:45 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2