note 105427 added to book.dbase
| From: | hrmohseni | Date: | Wed, 17 Aug 2011 03:27:16 +0000 |
| Subject: | note 105427 added to book.dbase | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182521@lists.php.net to get a copy of this message | ||
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
----
Server IP: 69.147.83.197
Probable Submitter: 202.169.29.43
----
Manual Page -- http://www.php.net/manual/en/book.dbase.php
Edit -- https://master.php.net/note/edit/105427
Del: integrated -- https://master.php.net/note/delete/105427/integrated
Del: useless -- https://master.php.net/note/delete/105427/useless
Del: bad code -- https://master.php.net/note/delete/105427/bad+code
Del: spam -- https://master.php.net/note/delete/105427/spam
Del: non-english -- https://master.php.net/note/delete/105427/non-english
Del: in docs -- https://master.php.net/note/delete/105427/in+docs
Del: other reasons-- https://master.php.net/note/delete/105427
Reject -- https://master.php.net/note/reject/105427
Search -- https://master.php.net/manage/user-notes.php