<HTML ><HEAD ><TITLE >dbase_create</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="dBase functions" HREF="ref.dbase.html"><LINK REL="PREVIOUS" TITLE="dbase_close" HREF="function.dbase-close.html"><LINK REL="NEXT" TITLE="dbase_delete_record" HREF="function.dbase-delete-record.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.dbase-close.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.dbase-delete-record.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.dbase-create" ></A >dbase_create</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN17207" ></A ><P > (PHP 3, PHP 4 )</P >dbase_create -- Creates a dBase database</DIV ><DIV CLASS="refsect1" ><A NAME="AEN17210" ></A ><H2 >Description</H2 >int <B CLASS="methodname" >dbase_create</B > ( string filename, array fields)<BR ></BR ><P > The <TT CLASS="parameter" ><I >fields</I ></TT > 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. </P ><P > The types of fields available are: <P ></P ><DIV CLASS="variablelist" ><DL ><DT >L</DT ><DD ><P > Boolean. These do not have a length or precision. </P ></DD ><DT >M</DT ><DD ><P > Memo. (Note that these aren't supported by PHP.) These do not have a length or precision. </P ></DD ><DT >D</DT ><DD ><P > Date (stored as YYYYMMDD). These do not have a length or precision. </P ></DD ><DT >N</DT ><DD ><P > Number. These have both a length and a precision (the number of digits after the decimal point). </P ></DD ><DT >C</DT ><DD ><P > String. </P ></DD ></DL ></DIV > </P ><P > If the database is successfully created, a dbase_identifier is returned, otherwise <TT CLASS="constant" ><B >FALSE</B ></TT > is returned. <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN17247" ></A ><P ><B >Example 1. Creating a dBase database file</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="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)) print "<strong>Error!</strong>";</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.dbase-close.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.dbase-delete-record.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >dbase_close</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.dbase.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >dbase_delete_record</TD ></TR ></TABLE ></DIV ></BODY ></HTML >