Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何连接到IP地址以访问php中的数据库_Php_Database_Ms Access_Odbc - Fatal编程技术网

如何连接到IP地址以访问php中的数据库

如何连接到IP地址以访问php中的数据库,php,database,ms-access,odbc,Php,Database,Ms Access,Odbc,如何连接到本地网络上的xxxx文件 SUCCESS $dbName = "C:\db.mdb"; if (!file_exists($dbName)) { die("Could not find database file."); } $db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=;"); $sql = "SELE

如何连接到本地网络上的xxxx文件

SUCCESS
    $dbName =  "C:\db.mdb";
    if (!file_exists($dbName)) {
        die("Could not find database file.");
    }
    $db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=;");
    $sql  = "SELECT * ";
    $sql .= "  FROM table1";
    print "<TABLE border='1'>";
    $result = $db->query($sql);
    while ($row = $result->fetch()) {

print "<tr>";
print "<td>" . $row["a1"]. " </td>";
print "<td>" . $row["a2"]." </td>";
print "<td>" . $row["a3"]." </td>";
print "</tr>";
}
echo "</TABLE>";
成功
$dbName=“C:\db.mdb”;
如果(!file_存在($dbName)){
die(“找不到数据库文件”);
}
$db=newPDO(“odbc:DRIVER={MicrosoftAccess驱动程序(*.mdb)};DBQ=$dbName;Uid=;Pwd=;”;
$sql=“选择*”;
$sql.=“来自表1”;
打印“”;
$result=$db->query($sql);
而($row=$result->fetch()){
打印“”;
打印“$row[“a1”]”;
打印“$row[“a2”]”;
打印“$row[“a3”]”;
打印“”;
}
回声“;
我从一家公司得到了同样的文件

不同的计算机

您想连接到一个

IP地址

。。。 我怎么做?

让您的共享文件夹-->属性-->共享-->在网络上共享此文件夹 您的Ip中的文件夹共享 像


$dbName=“\192.168.1.4\my fodler\database.mdb”

就像访问任何其他文件一样:Windows共享、NFS等等。Access本身的设计不包括任何网络协议。