Page 1 of 1

Problem with DBase parse. (.dbf)

Posted: Wed Feb 06, 2008 9:40 am
by nickelnick
heres the code I have, and still i am unable to return any values from this dbf.

Code: Select all

<?php
dbase_open('MNU.DBF', 2) or die ("Failed to open DBF");
if ($dbase_open) {
  $record_numbers = dbase_numrecords($dbase_open);
  for ($i = 1; $i <= $record_numbers; $i++) {
      // do something here, for each record
echo $record_numbers['SHORTNAME'];
  }
} 
?>

Re: Problem with DBase parse. (.dbf)

Posted: Wed Feb 06, 2008 11:07 am
by bouncer
are you giving the right path to your .dbf file ?

try use full path like this, and use this instead:

Code: Select all

 
$dbase = dbase_open('fullpath\MNU.dbf', 2) or die (error());
if ( $dbase ) {
    $record_numbers = dbase_numrecords( $dbase );
 
    for ($i = 1; $i <= $record_numbers; $i++) {
        $row = dbase_get_record_with_names($dbase, $i);
        echo $row['field_name'];
    }
}
dbase_close( $dbase );
 
regards

Re: Problem with DBase parse. (.dbf)

Posted: Wed Feb 06, 2008 11:29 am
by nickelnick
if i my root dir when i log in is httpdocs, does that mean i should put 'httpdocs\db\EMP.DBF', '\httpdocs\db\EMP.DBF'

or

db\EMP.DBF (or)
\db\EMP.DBF

Re: Problem with DBase parse. (.dbf)

Posted: Wed Feb 06, 2008 11:33 am
by bouncer
if your script is in the same root as your .dbf files you can avoid full path if not use the full path, i'm not sure about this. :roll:

regards

Re: Problem with DBase parse. (.dbf)

Posted: Wed Feb 06, 2008 11:37 am
by nickelnick
bouncer wrote:if your script is in the same root as your .dbf files you can avoid full path if not use the full path, i'm not sure about this. :roll:

regards
thats what i figured. is my database somehow not db4 even though it specifies on the file that it is?

Re: Problem with DBase parse. (.dbf)

Posted: Thu Feb 07, 2008 8:23 am
by bouncer
have you tried to use the script in the #2 thread ?

regards