Replace/Update record in dbase using dbase_replace_record()
| From: | Rahul Sitaram Johari | Date: | Mon, 02 Jul 2007 18:48:00 +0000 |
| Subject: | Replace/Update record in dbase using dbase_replace_record() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-258049@lists.php.net to get a copy of this message | ||
Ave,
Can¹t figure this one out. I¹m using the dbase_replace_record() function to
replace a record in a dbase (.dbf) database. I just want to replace the
value of one of the fields with another value. This is my code:
$db = dbase_open("CRUMBS.DBF", 2) or die("Fatal Error: Could not open
database!");
if ($db) {
$record_numbers = dbase_numrecords($db);
for ($i = 1; $i <= $record_numbers; $i++) {
$row = dbase_get_record_with_names($db, $i);
if ($row['PHONE'] == $thekey) {
print_r($row);
$row['A'] == "F";
dbase_replace_record($db, $row, 1);
}
}
}
dbase_close($db);
Basically I have a database called ³CRUMBS.DBF², and the record where PHONE
= $thekey, I want to replace the value of the field ³A² with ³F². I keep
getting the error: ³Wrong number of fields specified².
I have over 60 fields in each row and I just want to replace the value of
the field ³A².
Any suggestions?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.
W: http://www.rahulsjohari.com
E: sleepwalker@rahulsjohari.com
³I morti non sono piu soli ... The dead are no longer lonely²