Solved

How to read and write .dbf from php

Posted on 2008-10-29
8
4,111 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now