Guest error_error Posted February 17, 2006 Share Posted February 17, 2006 hii have tried to open a php file with code mentioned below and got following error,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:\Inetpub\wwwroot\test.php on line 3Connection Failed: i have create an ODBC connection to a MS Access Database but still having the same error.plz guide methanx a lot PHP 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> Link to comment Share on other sites More sharing options...
scott100 Posted February 17, 2006 Share Posted February 17, 2006 I take it you followed this tutorial: http://www.w3schools.com/php/php_db_odbc.aspmake sure you connect the database through odbc, double check you done this part correctly: Create an ODBC Connection Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now