PHP Classes

function getRow()

Recommend this page to a friend!

      DBF Class  >  All threads  >  function getRow()  >  (Un) Subscribe thread alerts  
Subject:function getRow()
Summary:return array, where key fields is field names
Messages:1
Author:Uldis Nelsons
Date:2011-09-15 13:41:22
 

  1. function getRow()   Reply   Report abuse  
Picture of Uldis Nelsons Uldis Nelsons - 2011-09-15 13:41:22
function getRow($recnum) {
$memoeot = chr(26).chr(26);
$rawrow = substr($this->_raw,$recnum*$this->_rowsize+$this->_hdrsize,$this->_rowsize);
$rowrecs = array();
$beg=1;
if (ord($rawrow[0])==42) {
return false; //Record is deleted...
}
for ($i=0; $i<$this->dbf_num_field; $i++) {
$col=trim(substr($rawrow,$beg,$this->dbf_names[$i]['len']));
if ($this->dbf_names[$i]['type']!='M') {
$rowrecs[$this->dbf_names[$i]['name']]=$col;
} else {
$memobeg=$col*512; //Find start of the memo block (0=header so it works)
$memoend=strpos($this->_memos,$memoeot,$memobeg); //Find the end of the memo
$rowrecs[$this->dbf_names[$i]['name']]=substr($this->_memos,$memobeg,$memoend-$memobeg);
}
$beg+=$this->dbf_names[$i]['len'];
}
return $rowrecs;
}