Difference between revisions of "Connecting to Access Database with PHP"

From Hostek.com Wiki
Jump to: navigation, search
(Created page with "==How to Connect to an Access Database with PHP== Note: This only works on our Windows servers. #Create a DSN in WCP #Use the following code example: <pre> <?php $DSN="myODBC...")
 
 
Line 4: Line 4:
 
#Create a DSN in WCP
 
#Create a DSN in WCP
 
#Use the following code example:
 
#Use the following code example:
<pre>
+
<syntaxhighlight lang="php">
 
<?php
 
<?php
 
$DSN="myODBC_DSN";
 
$DSN="myODBC_DSN";
Line 14: Line 14:
 
$Result = odbc_exec( $Connect, $QueryString );
 
$Result = odbc_exec( $Connect, $QueryString );
 
?>
 
?>
</pre>
+
</syntaxhighlight>

Latest revision as of 17:33, 23 May 2013

How to Connect to an Access Database with PHP

Note: This only works on our Windows servers.

  1. Create a DSN in WCP
  2. Use the following code example:
<?php
$DSN="myODBC_DSN";
$DSN_User="";
$DSN_Passwd="";
$QueryString="SELECT id, FirstName, LastName, Email FROM tblContact";
 
$Connect = odbc_connect( $DSN, $DSN_User, $DSN_Passwd );
$Result = odbc_exec( $Connect, $QueryString );
?>