luads / php-xbase

A simple parser for *.dbf files using PHP
MIT License
181 stars 83 forks source link

cannot handle datatype I #89

Closed imidimi closed 4 years ago

imidimi commented 4 years ago

For all the data types its working fine, but as soon I data type comes in any table it gives this error. Can you please review it?

gam6itko commented 4 years ago

Can you provide file and code example?

imidimi commented 4 years ago

Getting all fields for the table first. Then assigning them values. SALES.zip

$tableA = get('C:\\pcmrpw\\' . $saleTable);
$allColumns = $tableA->getColumns();

foreach ($allColumns as $key => $column) {
    $allColumns[$key] = isset($_POST[$key]) ? $_POST[$key] : '';
}

$tableB = add('C:\\pcmrpw\\' . $saleTable);
$tableB->openWrite();
$newRecord = $tableB->appendRecord();

foreach ($allColumns as $key => $column) {
    $newRecord->{$key} = isset($_POST[$key]) ? $_POST[$key] : '';
}

$tableB->writeRecord();
$tableB->pack();
$tableB->close();
unset($newRecord);
gam6itko commented 4 years ago

@imidimi I'll fix it asap

gam6itko commented 4 years ago

fixen in 2267452d19f0acaf456222a9c5e499576dbdc68b