downloads | documentation | faq | getting help | mailing lists | reporting bugs | sites | links | my 
search for in the  
view the version of this page
Last updated: Thu, 21 Aug 2003

XVIII. dBase functions


These functions allow you to access records stored in dBase-format (dbf) databases.

There is no support for indexes or memo fields. There is no support for locking, too. Two concurrent webserver processes modifying the same dBase file will very likely ruin your database.

dBase files are simple sequential files of fixed length records. Records are appended to the end of the file and delete records are kept until you call dbase_pack().

We recommend that you do not use dBase files as your production database. Choose any real SQL server instead; MySQL or Postgres are common choices with PHP. dBase support is here to allow you to import and export data to and from your web database, because the file format is commonly understood by Windows spreadsheets and organizers.


In order to enable the bundled dbase library and to use these functions, you must compile PHP with the --enable-dbase option.

Runtime Configuration

This extension has no configuration directives defined in php.ini.

Resource Types

This extension has no resource types defined.

Predefined Constants

This extension has no constants defined.

Table of Contents
dbase_add_record -- Add a record to a dBase database
dbase_close -- Close a dBase database
dbase_create -- Creates a dBase database
dbase_delete_record -- Deletes a record from a dBase database
dbase_get_header_info -- Get the header info of a dBase database
dbase_get_record_with_names --  Gets a record from a dBase database as an associative array
dbase_get_record -- Gets a record from a dBase database
dbase_numfields --  Find out how many fields are in a dBase database
dbase_numrecords --  Find out how many records are in a dBase database
dbase_open -- Opens a dBase database
dbase_pack -- Packs a dBase database
dbase_replace_record -- Replace a record in a dBase database

add a note add a note User Contributed Notes
dBase functions
john.holden at thirdsectorsystems com
15-Jul-2003 05:51
Why can't someone just use the flock() function to lock the dBase file before writing?
info at SyPlex dot net
10-Jan-2003 04:23
To answer to guillaume 07-Nov-2002 07:13:

Note that you have to remove the 'deleted' key which is not a field name.
guillaume dot sueur at geosignal dot fr
07-Nov-2002 10:13
To retrieve the name of the fields.

$dbi = dbase_open($db_path, 0);     // opens the dbf file
$res = dbase_get_record_with_names($dbi, 1); // throw record 1 into associative array key=>value
$cles = array_keys($res);// retrieves all  the keys from previous array, which are field names.
Joerg Aldinger
16-Sep-2001 09:04
Note that dBase support on Windows is disabled by default.
Uncomment the following line in your php.ini file to enable it:


 Last updated: Thu, 21 Aug 2003
show source | credits | sitemap | mirror sites 
Copyright © 2001-2003 The PHP Group
All rights reserved.
This mirror generously provided by:
Last updated: Sat 01 Nov 2003 04:13:36 EST EST