Format Description:
Date "D" - no field length or precision
NOTE: format "Ymd"
Logic "L" - no field length or precision
NOTE: must be entered as either "T" or "F"
Character "C" - field length no precision
NOTE: string will be truncated at given length
Numeric "N" - field length with precision
NOTE: Numeric includes precision
eg "45" = Length: 2, Precision: 0
eg "45.1" = Length:4, Precision:1
dbase_create
(PHP 4, PHP 5)
dbase_create — Crea un database dBase
Descrizione
int dbase_create
( string
$filename
, array $fields
)
dBase_create()crea un database dBase nel filefilename
con i campifields
Il parametro fields è un array di arrays,
ciascun array descrive il formato di un campo nel database. Ogni campo
consiste di un nome, un carattere che indica il tipo di campo, una
lunghezza, e una precisione.
I tipi di campo disponibili sono:
- L
- Boolean. Questi non hanno una lunghezza o una precisione.
- M
- Memo. (Nota che non sono supportati da PHP.) Questi non hanno una lunghezza o una precisione.
- D
- Date (memorizzate nel formato YYYYMMDD). Questi non hanno una lunghezza o una precisione.
- N
- Number. Questi hanno sia una lunghezza sia una precisione (il numero di decimali).
- C
- String.
Se il database è creato con successo, viene restituito un dbase_identifier, altrimenti viene restituito
FALSE.
Example #1 Creare un file di database dBase
<?php
// "database" name
$dbname = "/tmp/test.dbf";
// database "definition"
$def =
array(
array("date", "D"),
array("name", "C", 50),
array("age", "N", 3, 0),
array("email", "C", 128),
array("ismember", "L")
);
// creation
if (!dbase_create($dbname, $def))
echo "<strong>Error!</strong>";
?>
karl at kingkarl dot com ¶
4 years ago
