joni_demon
joni_demon

Reputation: 666

PHP export DBF file format

Do you have any idea on how to export a DBF file format using php without using the dbase function?

Upvotes: 0

Views: 3504

Answers (1)

Marki555
Marki555

Reputation: 6860

dBase DBF file format is quite easy. Many years ago I had to import data from dbf/fpt (FoxPro), but I used standard PHP functions to read dbf files and just manually scanned the format of fpt files, where the long memo records were stored (dbf contained only pointers inside fpt).

You can check for example this description of dbf format: dbf format

From there you can see that in the beginning there is a file header, which contains all information about the defined fields (field name, size, type and optionally any constraints). You will use PHP's fwrite() function to write the required binary data into the dbf files. After the header, dbf file contains individual records separated by space/asterisk. Individual fields inside a record are not separated, as each field has static length.

Upvotes: 1

Related Questions