PHP ODBC Accessing Foxpro Database

Here are the steps to prepare a development environment that utilize PHP to access Foxpro Database on Windows via Apache web server:

  1. Install XAMPP
  2. Install IDE of choice for PHP – for me, I use Netbeans 6.8 on Windows XP.  Download link:
  3. Install ODBC Visual Foxpro Driver
  4. Connecting to database as follows:
    $dsn = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=c:\\your database;Exclusive=NO;collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO;";
            $this->cnx= odbc_connect($dsn,"","");


Note:  one can use foxpro functions in query.  For example, converting a string date to date can be written as:

$query = “SELECT ponum from table WHERE  ctod(TRIM(podate)) between {{$start_date}} and {{$end_date}}
. order by podate”;

link to foxpro functions: