php with MS Acces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I tried the code below but i got an error ,
Im on a win2000 machine and I use php 4.3.3
Could someone help me out please!!!

----- Code -----
$db = '\\\\server\\resource\\db.mdb';
$conn = new COM('ADODB.Connection');
$conn->Open("DRIVER={Driver do Microsoft Access (*.mdb)}; DBQ=$db");

// Driver do Microsoft Access (*.mdb)
// must be the name in your odbc drivers, the one you get
// from the Data Sources (ODBC).
// In this case, I'm in Mexico but the driver name is in portuguese, thanks
Microsoft.

$sql = 'SELECT username FROM tblUsuarios';
$res = $conn->Execute($sql);
while (!$res->EOF)
{
    print $res->Fields['username']->Value . "<br>";
    $res->MoveNext();
}

$res->Close();
$conn->Close();
$res = null;
$conn = null;
----- End Code -----

---The error ---

Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft
OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC Microsoft
Access Driver]General error Unable to open registry key 'Temporary
(volatile) Jet DSN for process 0x5d8 Thread 0x1c4 DBC 0xae82f4 Jet'. in
E:\database.php on line 13

Warning: (null)(): Invoke() failed: Exception occurred. Source:
ADODB.Connection Description: Operation is not allowed when the object is
closed. in E:\database.php on line 21


Fatal error: Call to a member function on a non-object in E:\database.php on
line 25

---End of The error ---

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux