Using access database in php

对着背影说爱祢 提交于 2019-12-24 10:03:06

问题


I built a stock manager on VB.NET, it uses a MS Access Database. I also built a website, and on this website I want to relularly upload the updated MS Access database file onto the website and insert it into the mySql Database. Now my problem is I dont know how to access the MS Access file using php, im sure theres a way without buying those softwares, but i cant find it. Now I not bound to this scenario, if someone has better ideas i would appreciate it, most importantly I want the stock management to be offline, and at the end of the day, i want it uploaded to the site. Thanks alot


回答1:


I have done that in the past using ADODB and JET:

// connect
$conn = new COM('ADODB.Connection');
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={$database};Mode=ReadWrite;");

//query
$results = $conn->Execute($sql);

// retrieve
$results->Fields[$field]->Value;

// navigation
$results->MoveNext();
$results->Move($count);
$results->EOF();

// Close (don't forget)
$conn->Close();

This is just a small sample. More Help




回答2:


Look into php_odbc which has the ability to communicate with MS Access if you have correctly configured an ODBC data source on the PHP server. php_odbc documentation here.

// From the `odbc_connect()` documentation:
// Microsoft Access
$connection = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$mdbFilename", $user, $password);


来源:https://stackoverflow.com/questions/6062033/using-access-database-in-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!