|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-02-08 11:03 UTC] tony2001@php.net
[2005-02-26 01:00 UTC] php-bugs at lists dot php dot net
[2011-10-12 14:15 UTC] tmylward at alphacrc dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 00:00:02 2025 UTC |
Description: ------------ I have found a bug on page function.dbase-add-record.html [chm date: 2004-12-26]... I can read from a .dbf file with PHP but I cannot write to it. I have used PHP to create the .dbf or I have used my normally created .dbf with the same structure. The same HTML input screen collects data so that I can write a .txt delimited file with it and append it into the .dbf but the prescribed code from the examples fails when the dbase_open() flag is set to '1' or '2' as required to write the data. All of the echo lines show me that the fields are filled properly. The dbase_open() command works well when the flag is set to '0' for reading. I can output the data that I have put into the .dbf by appending from the .txt file. Reproduce code: --------------- <?php $filename="collect.txt"; $name="$_POST[name]"; $street="$_POST[street]"; $city="$_POST[city]"; $prov="$_POST[prov]"; $country="$_POST[country]"; $postal="$_POST[postal]"; $tel="$_POST[tel]"; $mail="$_POST[mail]"; $fax="$_POST[fax]"; echo "<strong> $name</strong><br>"; echo "<strong> $street</strong><br>"; echo "<strong> $city</strong><strong>, $prov</strong><strong>, $country</strong><br>"; echo "<strong> $postal</strong><br>"; echo "<strong> $tel</strong><br>"; echo "<strong> $mail</strong><br>"; echo "<strong> $fax</strong><br>"; $db=dbase_open("collectx.dbf",2) ; $def = array (trim($name), trim($street), trim($city), trim($prov), trim($country), trim($postal), trim($tel), trim($mail), trim($fax)); dbase_add_record($db, $def); dbase_close($db) ?> Expected result: ---------------- I expect to be able to fill a .dbf file with HTML input as collected in the fields that echo their contents to me, above. Thank you for your assistance. Actual result: -------------- Warning: dbase_open() [function.dbase-open]: unable to open database collectx.dbf in c:\Inetpub\wwwroot\collect.php on line 23