Solved

How to read and write .dbf from php

Posted on 2008-10-29
8
4,118 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

914 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

18 Experts available now in Live!

Get 1:1 Help Now