note 71641 deleted from faq.databases by bjori

From: Date: Sat, 09 Dec 2006 20:18:26 +0000
Subject: note 71641 deleted from faq.databases by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-120459@lists.php.net to get a copy of this message
Note Submitter: Ray Paseur sometimes uses GMail Reason: bad code ---- 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); }

« previous php.notes (#120459) next »