PHP Manual
Prev |  | Next

# dbase_create

dbase_create -- Creates a dBase database

## Description

`int dbase_create`(string filename, array fields);

The `fields` parameter is an array of arrays, each array describing the format of one field in the database. Each field consists of a name, a character indicating the field type, a length, and a precision.

The types of fields available are:

L

  Boolean. These do not have a length or precision.

M

  Memo. (Note that these aren't supported by PHP.) These do not have a length or precision.

D

  Date (stored as YYYYMMDD). These do not have a length or precision.

N

  Number. These have both a length and a precision (the number of digits after the decimal point).

C

  String.

If the database is successfully created, a dbase_identifier is returned, otherwise false is returned.

Example 1. Creating a dBase database file
      1
      2 // "database" name
      3 $dbname = "/tmp/test.dbf";
      4
      5 // database "definition"
      6 $def =
      7     array(
      8         array("date",     "D"),
      9         array("name",     "C",  50),
     10         array("age",      "N",   3, 0),
     11         array("email",    "C", 128),
     12         array("ismember", "L")
     13     );
     14
     15 // creation
     16 if (!dbase_create($dbname, $def))
     17     print "<strong>Error!</strong>";
     18

Prev | Home | Next
dBase functions | Up | dbase_open