<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Introduction</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="book.dbase.html">dBase</a></div> <div class="next" style="text-align: right; float: right;"><a href="dbase.setup.html">Installing/Configuring</a></div> <div class="up"><a href="book.dbase.html">dBase</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="intro.dbase" class="preface"> <h1 class="title">Introduction</h1> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> This extension has been moved to the <a href="http://pecl.php.net/" class="link external">» PECL</a> repository and is no longer bundled with PHP as of PHP 5.3.0. </p> </p></blockquote> <p class="para"> These functions allow you to access records stored in dBase-format (dbf) databases. </p> <div class="warning"><strong class="warning">Warning</strong> <p class="para"> We recommend against using dBase files as your production database. Use <a href="http://sqlite.org/" class="link external">» SQLite</a> or choose any real SQL server instead; <a href="http://www.mysql.com/" class="link external">» MySQL</a> or <a href="http://www.postgresql.org/" class="link external">» Postgres</a> 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. </p> </div> <div class="caution"><strong class="caution">Caution</strong> <p class="para"> As of dbase 7.0.0 the databases are automatically locked via <span class="function"><a href="function.flock.html" class="function">flock()</a></span>. There has been no support for locking earlier, so two concurrent web server processes modifying the same dBase file would have very likely ruined your database. This can happen even with dbase 7.0.0+ on systems which implement the locks at the process level with multithreaded SAPIs such as ISAPI. </p> </div> <p class="para"> dBase files are simple sequential files of fixed length records. Records are appended to the end of the file and deleted records are kept until you call <span class="function"><a href="function.dbase-pack.html" class="function">dbase_pack()</a></span>. </p> <p class="para"> Only dbf file levels 3 (dBASE III+) - 5 (dBASE V) are supported. The types of dBase fields available are: <table class="doctable table"> <caption><strong>Available types of fields</strong></caption> <thead> <tr> <th>Field</th> <th>dBase Type</th> <th>Format</th> <th>Additional information</th> </tr> </thead> <tbody class="tbody"> <tr> <td><em>M</em></td> <td>Memo</td> <td>n/a</td> <td>This type is not supported by PHP, such field will be ignored</td> </tr> <tr> <td><em>D</em></td> <td>Date</td> <td><em>YYYYMMDD</em></td> <td>The field length is limited to 8</td> </tr> <tr> <td><em>T</em></td> <td>DateTime</td> <td><em>YYYYMMDDhhmmss.uuu</em></td> <td>(FoxPro) No validity checks are done. Available as of dbase 7.0.0.</td> </tr> <tr> <td><em>N</em></td> <td>Number</td> <td>A number</td> <td> You must declare a length and a precision (the number of digits after the decimal point). </td> </tr> <tr> <td><em>F</em></td> <td>Float</td> <td>A float number</td> <td>Same as <em>N</em>. Available as of PHP 5.2.0</td> </tr> <tr> <td><em>C</em></td> <td>String</td> <td>A string</td> <td>You must declare a length. When retrieving data, the string will be right-padded with spaces to fit the declared length. Overlong strings will be silently truncated when storing data.</td> </tr> <tr> <td><em>L</em></td> <td>Boolean</td> <td> <em>T</em> or <em>Y</em> for <strong><code>TRUE</code></strong>, <em>F</em> or <em>N</em> for <strong><code>FALSE</code></strong>, <em>?</em> for uninitialized. </td> <td> As of dbase 7.0.0, returned as a <span class="type"><a href="language.types.boolean.html" class="type bool">bool</a></span> (<strong><code>TRUE</code></strong> or <strong><code>FALSE</code></strong>), or <strong><code>NULL</code></strong> for uninitialized fields. Formerly, returned as an <span class="type"><a href="language.types.integer.html" class="type int">int</a></span> (<em>1</em> or <em>0</em>). </td> </tr> </tbody> </table> </p> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> As of dbase 7.0.0 nullable fields are supported for <strong><code>DBASE_TYPE_FOXPRO</code></strong> databases. If a field is nullable, passing <strong><code>NULL</code></strong> will set the respective flag, and on later retrieval the field value will be <strong><code>NULL</code></strong>. </p> </p></blockquote> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> There is no support for indexes or memo fields. </p> </p></blockquote> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="book.dbase.html">dBase</a></div> <div class="next" style="text-align: right; float: right;"><a href="dbase.setup.html">Installing/Configuring</a></div> <div class="up"><a href="book.dbase.html">dBase</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>