note 105427 deleted from book.dbase by danbrown
| From: | danbrown@php.net | Date: | Wed, 17 Aug 2011 15:32:16 +0000 |
| Subject: | note 105427 deleted from book.dbase by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182528@lists.php.net to get a copy of this message | ||
Note Submitter: hrmohseni[at]gmail.com
----
thanks for Eric for his function.
I had problem with dbf deleted records that included in his function output. I read the dbf
structure and found that his function skip the first char that indicate it is deleted record on
following line:
fseek($fdbf, $header['FirstRecord']+1); // move back to the start of the first record
(after the field definitions)
you just need to delete +1 on fseek() to read first character.
if you do not want to include deleted record in your output you can simply add these lines:
/**Original Eric Code**/
for ($i=1; $i<=$header['RecordCount']; $i++) {
$buf = fread($fdbf,$header['RecordLength']);
/**My checking**/
if (substr($buf,0,1)=="*"){
continue;
}
...
wish you good luck
Hamid