note 54397 deleted from function.dbase-get-record-with-names by cmb
| From: | cmb@php.net | Date: | Fri, 28 Oct 2016 11:50:30 +0000 |
| Subject: | note 54397 deleted from function.dbase-get-record-with-names by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-206970@lists.php.net to get a copy of this message | ||
Note Submitter: bishop
----
I would like to emphasize that record numbers begin with 1, not 0. So, this is wrong:
<?php
$recCnt = dbase_numrecords($fh);
for ($recNum = 0; $recNum < $recCnt; $recNum++) {
// wrong! first record will fail
$record = dbase_get_record_with_names($fh, $recNum);
}
?>
This is right:
<?php
$recCnt = dbase_numrecords($fh);
for ($recNum = 1; $recNum <= $recCnt; $recNum++) {
// right! record #s begin with 1, don't forget <=
$record = dbase_get_record_with_names($fh, $recNum);
}
?>