\dbf_class
DBF reader Class v0.04 by Faro K Rasyid (Orca) orca75_at_dotgeek_dot_org v0.05 by Nicholas Vrtis vrtis_at_vrtisworks_dot_com 1) changed to not read in complete file at creation.
2) added function to read individual rows
3) added support for Memo fields in dbt files.
4) See: http://www.clicketyclick.dk/databases/xbase/format/dbf.html#DBF_STRUCT
for some additional information on XBase structure...
5) NOTE: the whole file (and the memo file) is read in at once. So this could
take a lot of memory for large files.
Input : name of the DBF( dBase III plus) file
Output : - dbf_num_rec, the number of records
- dbf_num_field, the number of fields
- dbf_names, array of field information ('name', 'len', 'type')
Usage example:
$file= "your_file.dbf";//WARNING !!! CASE SENSITIVE APPLIED !!!!!
$dbf = new dbf_class($file);
$num_rec=$dbf->dbf_num_rec;
$num_field=$dbf->dbf_num_field;
for($i=0; $i<$num_rec; $i++){
$row = $dbf->getRow($i);
for($j=0; $j<$num_field; $j++){
echo $row[$j].' ');
}
echo('<br>');
}
Thanks to :
- Willy
- Miryadi
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
Synopsis
- // members
- public $dbf_num_rec;
- public $dbf_num_field;
- public array $dbf_names = ;
- public $_raw;
- public $_rowsize;
- public $_hdrsize;
- public $_memos;
- // methods
- public void __construct()
- public void getRow()
- public void getRowAssoc()
Members
public
- $_hdrsize
- $_memos
- $_raw
- $_rowsize
- $dbf_names
- $dbf_num_field
- $dbf_num_rec