<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<refentry xml:id="function.dbase-create" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>dbase_create</refname>
  <refpurpose>Creates a database</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>int</type><methodname>dbase_create</methodname>
   <methodparam><type>string</type><parameter>filename</parameter></methodparam>
   <methodparam><type>array</type><parameter>fields</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>dbase_create</function> creates a dBase database with the given
   definition.
  </para>
  &note.sm.uidcheck;
  &note.open-basedir.func;
 </refsect1>
 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>filename</parameter></term>
     <listitem>
      <para>
       The name of the database. It can be a relative or absolute path to
       the file where dBase will store your data.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>fields</parameter></term>
     <listitem>
      <para>
       An array of arrays, each array describing the format of one field of the
       database. Each field consists of a name, a character indicating the field
       type, and optionally, a length, and a precision.
      </para>
      <note>
       <para>
        The fieldnames are limited in length and must not exceed 10 chars.
       </para>
      </note>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>
 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Returns a database link identifier if the database is successfully created,
   or &false; if an error occurred.
  </para>
 </refsect1>
 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Creating a dBase database file</title>
    <programlisting role="php">
<![CDATA[
<?php

// 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('/tmp/test.dbf', $def)) {
  echo "Error, can't create the database\n";
}

?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>
 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>dbase_open</function></member>
    <member><function>dbase_close</function></member>
   </simplelist>
  </para>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->