note 81027 modified in function.dbase-replace-record by felipe
| From: | felipe@php.net | Date: | Sun, 18 Jan 2009 17:10:14 +0000 |
| Subject: | note 81027 modified in function.dbase-replace-record by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149389@lists.php.net to get a copy of this message | ||
Actually you have to change the read array from key based to element (numeric) based and everything
works correctly!
<?php
$db = dbase_open( "yourfile.dbf", 2); // 0=RO, 1=WO, 2=RW
if ($db) {
$row = dbase_get_record_with_names($db, 1);
unset($row["deleted"]); // drop the field
// do whatever it is you want to the $row["elements"]
// then convert to numeric to store:
$rarr = array();
foreach ($row as $i=>$vl) $rarr[] = $vl;
dbase_replace_record($db, $rarr, 1);
dbase_close($db);
}
?>
That code actually works!
--was--
Actually you have to change the read array from key based to element (numeric) based and everything
works correctly!
$db = dbase_open( "yourfile.dbf", 2); // 0=RO, 1=WO, 2=RW
if ($db) {
$row = dbase_get_record_with_names($db, 1);
unset($row["deleted"]); // drop the field
// do whatever it is you want to the $row["elements"]
// then convert to numeric to store:
$rarr = array();
foreach ($row as $i=>$vl) $rarr[] = $vl;
dbase_replace_record($db, $rarr, 1);
dbase_close($db);
}
That code actually works!
--- Want to be famous?
http://www.3famous.com/ - 100% PHP BABY!
http://php.net/manual/en/function.dbase-replace-record.php