jarv Posted April 18, 2007 Share Posted April 18, 2007 Is my code ok? <?php $db = 'C:\\Inetpub\\wwwroot\\php\\db\\tellist.mdb'; $conn = new COM('ADODB.Connection') or exit('Cannot start ADO.'); $conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db") or exit('Cannot open with Jet.'); $sql = 'SELECT * FROM phonebook'; $rs = $conn->Execute($sql); ?> <table> <tr> <th>Client</th> <th>Name</th> <th>Number</th> </tr> <?php while (!$rs->EOF) { ?> <tr> <td><?php echo $rs->Fields['rsClient']->Value ?></td> <td><?php echo $rs->Fields['rsName']->Value ?></td> <td><?php echo $rs->Fields['rsNumber']->Value ?></td> </tr> <?php $rs->MoveNext() ?> <?php } ?> </table> <?php $rs->Close(); $conn->Close(); $rs = null; $conn = null; ?> Quote Link to comment Share on other sites More sharing options...
jarv Posted April 18, 2007 Author Share Posted April 18, 2007 please help! Quote Link to comment Share on other sites More sharing options...
jarv Posted April 18, 2007 Author Share Posted April 18, 2007 ok I changed the JET line 8 and now line 8 looks like this: $conn->Open("Microsoft Access Driver ; Data Source=$db"); this is my error: PHP Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified' in C:\Inetpub\wwwroot\php\test.php:8 Stack trace: #0 C:\Inetpub\wwwroot\php\test.php(: com->Open('Microsoft Acces...') #1 {main} thrown in C:\Inetpub\wwwroot\php\test.php on line 8 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.