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; ?> Link to comment https://forums.phpfreaks.com/topic/47528-cannot-open-with-jet/ Share on other sites More sharing options...
jarv Posted April 18, 2007 Author Share Posted April 18, 2007 please help! Link to comment https://forums.phpfreaks.com/topic/47528-cannot-open-with-jet/#findComment-232012 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 Link to comment https://forums.phpfreaks.com/topic/47528-cannot-open-with-jet/#findComment-232014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.