User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 427,731 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,898 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 711 | Replies: 3 | Solved
Join Date: Jan 2008
Posts: 26
Reputation: abdulraqeeb33 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
abdulraqeeb33 abdulraqeeb33 is offline Offline
Light Poster

odbc-connect error--urgent

  #1  
Apr 24th, 2008
Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\xampp\htdocs\xampp\display.php on line 5
Connection Failed:

php is working fine, ran other simple php scripts...
but this is the error when i connect to a ms access db


  1. <html>
  2. <body>
  3.  
  4. <?php
  5. $conn=odbc_connect("DB",'','');
  6. if (!$conn)
  7. {exit("Connection Failed: " . $conn);}
  8. $sql="SELECT * FROM customers";
  9. $rs=odbc_exec($conn,$sql);
  10. if (!$rs)
  11. {exit("Error in SQL");}
  12. echo "<table><tr>";
  13. echo "<th>IP</th>";
  14. echo "<th>MAC</th></tr>";
  15. while (odbc_fetch_row($rs))
  16. {
  17. $name=odbc_result($rs,"ip");
  18. $macname=odbc_result($rs,"mac");
  19. echo "<tr><td>$name</td>";
  20. echo "<td>$macname</td></tr>";
  21. }
  22. odbc_close($conn);
  23. echo "</table>";
  24. ?>
  25.  
  26. </body>
  27. </html>

the dsn exists and i have selected a db which has the table clients_online and other fields such as ip and mac exist
Last edited by peter_budo : Apr 26th, 2008 at 7:20 am. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 12:27 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC