English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I upload the *.mdb file on my website and I need a simple PHP script to connect to that database.

The local connection was successful, but when I uploaded it, it doensn't work anymore, here's the code:



$db_conn = new COM("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("./Database1.mdb").";";
$db_conn->open($connstr);

$rS = $db_conn->execute("SELECT * FROM Customers");
$f1 = $rS->Fields(0);
$f2 = $rS->Fields(1);

while (!$rS->EOF)
{
print $f1->value." ".$f2->value."
\n";
$rS->MoveNext();
}
$rS->Close();
$db_conn->Close();
?>


2007-09-02 00:02:32 · 2 answers · asked by markbriones 2 in Computers & Internet Programming & Design

2 answers

What is the operating system on the remote server? Most of Web hosting companies run Linux, while working with COM objects is only possible on Windows.

2007-09-04 12:29:13 · answer #1 · answered by NC 7 · 1 0

U haven't mentioned error u get.
If ur code was successful on local connection, u may need to change connection string. Consult ur service provider. Check whether it supports access databases.
Even though ur service provider supports access databases, check support for DSN or DSN-less databases & then check what drivers are being supported (may be u need microsoft jet provider e.g. "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db" ). And finally, if required, check path of .mdb file, are u using the correct path

2007-09-02 08:46:00 · answer #2 · answered by friend 3 · 0 0

fedest.com, questions and answers