php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31577 [chm] bug on function.dbase-add-record.html
Submitted: 2005-01-16 22:34 UTC Modified: 2005-02-26 01:00 UTC
Votes:2
Avg. Score:3.0 ± 2.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: sand001 at sympatico dot ca Assigned:
Status: No Feedback Package: dBase related
PHP Version: 5.0.2 OS: windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
24 - 19 = ?
Subscribe to this entry?

 
 [2005-01-16 22:34 UTC] sand001 at sympatico dot ca
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



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-08 11:03 UTC] tony2001@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


Please check if your webserver has all access privileges to the dbf file.
 [2005-02-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2011-10-12 14:15 UTC] tmylward at alphacrc dot com
I have a similar problem. I can read all of the 122 .DBF files supplied by my Company. 
However, when I attempt to open any file with read/write or writeOnly permissions, the file will NOT open.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 11:01:27 2024 UTC