note 100024 deleted from function.dbase-replace-record by cmb
| From: | cmb@php.net | Date: | Sat, 06 Aug 2016 14:25:28 +0000 |
| Subject: | note 100024 deleted from function.dbase-replace-record by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-206225@lists.php.net to get a copy of this message | ||
Note Submitter: xamkan at yahoo dot com
----
// simply use 'dbase_get_record' instead of 'dbase_get_record_with_names', for
'dbase_replace_record', 'dbase_add_record', or 'dbase_delete_record',
to work
<?php
// open in read-write mode
$db = dbase_open('/tmp/test.dbf', 2) or die("Error! Could not open dbase database
file /tmp/test.dbf."); // 0=RO, 1=WO, 2=RW
// gets the old row
$row = dbase_get_record($db, 1);
// remove the 'deleted' entry from the array
unset($row['deleted']);
// Update the date field with the current timestamp
$row['date'] = date('Ymd');
// Replace the record
dbase_replace_record($db, $row, 1);
dbase_close($db);
?>