Solved

How to read and write .dbf from php

Posted on 2008-10-29
8
4,164 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 Comments
 
LVL 51

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 51

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 51

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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

636 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