Solved

How to read and write .dbf from php

Posted on 2008-10-29
8
4,134 Views
Last Modified: 2013-12-13
I am developing some sort of a bridge between an online reservation system and an old dispatching system that uses .dbf files.
Does anybody know how to accomplish this from php?
Do I need any additional library? or could somebody provide some code sample

Appreciate your help
0
Comment
Question by:Infierny
  • 3
  • 2
8 Comments
 
LVL 50

Expert Comment

by:Steve Bink
ID: 22837711
That totally depends on the format of those .dbf files.  If it is actually based on the dBase file format, you have some hope.  I believe FoxPro uses dbf as well.  If it is some proprietary format that just happens to use the dbf extension, you will have to discover the file structure before they can be used.  That's not an easy task.  Do you still have access to the old dispatching system?  What does it run?  

If it does follow a standard dbf format, it should match against this key:

http://www.dbf2002.com/dbf-file-format.html

You can also try searching for "dbf reader" or "dbf files".  There are many 3rd party readers created to handle these older formats.
0
 

Author Comment

by:Infierny
ID: 22841069
Hello routinet,

The files were created with visual foxpro and the system seems to be built under visual basic.
I would still appreciate if someone could provide with some sample code to write data to those files.

Thank you very much for your help
0
 
LVL 50

Expert Comment

by:Steve Bink
ID: 22842495
The better option is to import the old records into your new database, and edit them from there.  Reading is not too much of a job, but recreating the file structure for output can be a little more difficult.  It might even be possible for you to just access them directly with FoxPro, if you still have a copy of the software lying around.  

What is your end goal for the data?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:Infierny
ID: 22842940
I do have a copy of the old system, I do have the source code for the old system as well. The final goal of all of this is to get the online reservations we get through a Mysql database into the old dispatching software.
We want that to be working until we come up with the new software.
Any ideas on how to work around this!?
0
 
LVL 50

Accepted Solution

by:
Steve Bink earned 50 total points
ID: 22843691
What you need is a migration scheme, and one that can act as an ongoing import from one system to another.  That means you'll need to code an app that can take the MySQL data and put it into dbf format.  If you're still using FoxPro with the old system, there may be some type of import feature available to you.  If you know how to import, then pulling the data from MySQL and formatting that data appropriately should be a relatively easy task.  Without that import feature, then you have to depend on writing the data manually to the files, which can screw up everything if it is not done correctly.  By far, the better scenario is to let the app store the data you feed to it.
0
 
LVL 30

Expert Comment

by:Mike Lazarus
ID: 22849185
If the DBF file is unmodified FoxPro, then you may be able to just read/write via ODBC
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Split wordpress loop 35 56
Custom Wordpress Loop 22 39
issue with DB import 1 18
How would I implement CDN functionality in a custom PHP-based CMS and application? 12 21
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question