doubi6303 2013-01-14 03:53
浏览 44

php使用ms访问

Because no one answer my question Codeigniter using ms access database , i make new question i not using codeigniter

if I using mdb from my computer it works but if i using mdb from another computer in my network

i got error this is my CODE

<?php

$connect = odbc_connect("testdb", "", "");
$query = "SELECT * FROM ACGroup";
$result = odbc_exec($connect, $query);

while(odbc_fetch_row($result)){
  $name = odbc_result($result, 1);
  echo("$name");
}

?>

i make odbc where the data its from another computer in my network

"testdb" are data sourcename and database \\ip\folder\testdb.mdb

and i got this error

   Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Microsoft Access Driver] 
    The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data.,
     SQL state S1000 in SQLConnect in D:\blabla\coba.php on line 3

I already try folder setting but it not work

  • 写回答

2条回答 默认 最新

  • douwen6274 2013-01-14 04:40
    关注

    The ODBC connection string you are using ("testdb") does not even specify a database driver, much less a database file. You will need to read up on the appropriate format for $dsn. (The php.net page even has a few examples for Access files.)

    评论

报告相同问题?