Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to read and write .dbf from php

Posted on 2008-10-29
8
Medium Priority
?
4,195 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
6 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
Technology Partners: 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 200 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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.
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…
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 …
Suggested Courses

772 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