note 43947 deleted from function.odbc-connect by cmb

From: Date: Sun, 11 Dec 2016 12:15:52 +0000
Subject: note 43947 deleted from function.odbc-connect by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208554@lists.php.net to get a copy of this message
Note Submitter: f dot chehimi at lancaster dot ac dot uk (Fadi) ---- This is the typical solution with the steps to follow if someone wants to connect MS Access to PHP. it took me a couple of hours actually till i reached it. i just wanted to ease the hassle for my colleagues in order not to waste their time as i did. this is the duty of every programmer towards his/her peers :p here you are the CAKE :) <?php // to have this working: // 1- u have first to creat ur access database using MS // Access (i asume u know how to do this). My database // that i used in my example is called "Questionaire.mdb". // the table in it is called "Results" // // 2- then u have to add this database to ODBC in the // control panel. // // 3- the adition happens by adding "MS Access Driver" to the // "System DNS" tab in ODBC Data Source Administrator. if // u have that "MS Access Driver" in "User DNS" tab, then // u have to delete it. // // 4- click on Add in the "System DNS" tab. // // 5- choose "MS Access Driver" from the "Creat New // Database Source" window and click finish. // // 6- then the "ODBC MS Access Setup" window will pop-up. // // 7- give the driver the name that you want to use in your // PHP scripting. i used here "MSAccessDriver". // 8- after this, choose the "Select" button in "ODBC MS // Access Setup" to set the path of your Access database. // // 9-then u r done!! // this odbc_connect does the connection to the driver i // created in the ODBC Administrator $con = odbc_connect('MSAccessDriver','',''); if ($con) { echo "odbc connected<br>"; $sql = "select * from Results"; //this function will execute the sql satametn in //correspondance to the table in the db $exc = odbc_exec($con,$sql); } else echo "odbc not connected<br>"; if($exc) { echo "selection completed<br>"; while($row = odbc_fetch_row($exc) ) echo $row->id."<br>"; } else echo "selection failed<br>"; ?>

« previous php.notes (#208554) next »