note 71641 added to faq.databases
| From: | RayPaseursometimesusesGMail at osu1 dot php dot net | Date: | Sat, 09 Dec 2006 14:51:01 +0000 |
| Subject: | note 71641 added to faq.databases | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120455@lists.php.net to get a copy of this message | ||
To use my client's Microsoft Access Database with PHP under Windows IIS, this worked:
// ACCESS DATA BASE CONNECTION
$mdbfile = str_replace("/", "\\", $_SERVER["DOCUMENT_ROOT"]);
$mdbfile .="\\FILE\\PATH\\TO\\DATABASE.mdb";
if (!file_exists($mdbfile)) { echo "<br />NO SUCH FILE EXISTS $mdbfile"; die(); }
$db_connection = odbc_connect("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$mdbfile",
"ADODB.Connection", "PASSWORD", "SQL_CUR_USE_ODBC");
// echo "<!-- db_connection:$db_connection -->\n";
// QUERY FUNCTION RETURNS AN ARRAY OF RESULTS OR FALSE IF NOTHING WAS FOUND
function query($sql) {
global $db_connection;
if (!$result = odbc_exec($db_connection, $sql)) { echo odbc_errormsg($db_connection); die("
SQL FAILED"); }
$kount = 1;
while (odbc_fetch_row($result)) {
$return_array[] = odbc_fetch_array( $result, $kount );
$kount++;
}
if (!is_array($return_array)) {
return false; }
return ($return_array);
}
----
Server IP: 66.163.161.117
Probable Submitter: 72.205.62.162
----
Manual Page -- http://www.php.net/manual/en/faq.databases.php
Edit -- https://master.php.net/note/edit/71641
Del: integrated -- https://master.php.net/note/delete/71641/integrated
Del: useless -- https://master.php.net/note/delete/71641/useless
Del: bad code -- https://master.php.net/note/delete/71641/bad+code
Del: spam -- https://master.php.net/note/delete/71641/spam
Del: non-english -- https://master.php.net/note/delete/71641/non-english
Del: in docs -- https://master.php.net/note/delete/71641/in+docs
Del: other reasons-- https://master.php.net/note/delete/71641
Reject -- https://master.php.net/note/reject/71641
Search -- https://master.php.net/manage/user-notes.php