<!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>Gets the header info of a database</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.dbase-delete-record.html">dbase_delete_record</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.dbase-get-record-with-names.html">dbase_get_record_with_names</a></div> <div class="up"><a href="ref.dbase.html">dBase Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.dbase-get-header-info" class="refentry"> <div class="refnamediv"> <h1 class="refname">dbase_get_header_info</h1> <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">dbase_get_header_info</span> — <span class="dc-title">Gets the header info of a database</span></p> </div> <div class="refsect1 description" id="refsect1-function.dbase-get-header-info-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><strong>dbase_get_header_info</strong></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$dbase_identifier</code></span> )</div> <p class="para rdfs-comment"> Returns information on the column structure of the given database link identifier. </p> </div> <div class="refsect1 parameters" id="refsect1-function.dbase-get-header-info-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">dbase_identifier</code></em></span> <dd> <p class="para"> The database link identifier, returned by <span class="function"><a href="function.dbase-open.html" class="function">dbase_open()</a></span> or <span class="function"><a href="function.dbase-create.html" class="function">dbase_create()</a></span>. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.dbase-get-header-info-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> An indexed array with an entry for each column in the database. The array index starts at 0. </p> <p class="para"> Each array element contains an associative array of column information, as described here: <dl> <dt> <span class="term">name</span> <dd> <span class="simpara"> The name of the column </span> </dd> </dt> <dt> <span class="term">type</span> <dd> <span class="simpara"> The human-readable name for the dbase type of the column (i.e. date, boolean, etc.) </span> </dd> </dt> <dt> <span class="term">length</span> <dd> <span class="simpara"> The number of bytes this column can hold </span> </dd> </dt> <dt> <span class="term">precision</span> <dd> <span class="simpara"> The number of digits of decimal precision for the column </span> </dd> </dt> <dt> <span class="term">format</span> <dd> <span class="simpara"> A suggested <span class="function"><a href="function.printf.html" class="function">printf()</a></span> format specifier for the column </span> </dd> </dt> <dt> <span class="term">offset</span> <dd> <span class="simpara"> The byte offset of the column from the start of the row </span> </dd> </dt> </dl> </p> <p class="para"> If the database header information cannot be read, <strong><code>FALSE</code></strong> is returned. </p> </div> <div class="refsect1 examples" id="refsect1-function.dbase-get-header-info-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-1097"> <p><strong>Example #1 Showing header information for a dBase database file</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// Path to dbase file<br /></span><span style="color: #0000BB">$db_path </span><span style="color: #007700">= </span><span style="color: #DD0000">"/tmp/test.dbf"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Open dbase file<br /></span><span style="color: #0000BB">$dbh </span><span style="color: #007700">= </span><span style="color: #0000BB">dbase_open</span><span style="color: #007700">(</span><span style="color: #0000BB">$db_path</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">)<br /> or die(</span><span style="color: #DD0000">"Error! Could not open dbase database file '</span><span style="color: #0000BB">$db_path</span><span style="color: #DD0000">'."</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Get column information<br /></span><span style="color: #0000BB">$column_info </span><span style="color: #007700">= </span><span style="color: #0000BB">dbase_get_header_info</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Display information<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$column_info</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.dbase-delete-record.html">dbase_delete_record</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.dbase-get-record-with-names.html">dbase_get_record_with_names</a></div> <div class="up"><a href="ref.dbase.html">dBase Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>