PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
nickelnick
Forum Newbie
Posts: 6 Joined: Thu Jan 17, 2008 2:26 pm
Post
by nickelnick » Wed Feb 06, 2008 9:40 am
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'];
}
}
?>
Attachments
MNU.ZIP
Rename from to ZIP From DBF. THIS FILE is supposed to be DBase IV (10.17 KiB) Downloaded 14 times
bouncer
Forum Contributor
Posts: 162 Joined: Wed Feb 28, 2007 10:31 am
Post
by bouncer » Wed Feb 06, 2008 11:07 am
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
nickelnick
Forum Newbie
Posts: 6 Joined: Thu Jan 17, 2008 2:26 pm
Post
by nickelnick » Wed Feb 06, 2008 11:29 am
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
bouncer
Forum Contributor
Posts: 162 Joined: Wed Feb 28, 2007 10:31 am
Post
by bouncer » Wed Feb 06, 2008 11:33 am
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.
regards
nickelnick
Forum Newbie
Posts: 6 Joined: Thu Jan 17, 2008 2:26 pm
Post
by nickelnick » Wed Feb 06, 2008 11:37 am
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.
regards
thats what i figured. is my database somehow not db4 even though it specifies on the file that it is?
bouncer
Forum Contributor
Posts: 162 Joined: Wed Feb 28, 2007 10:31 am
Post
by bouncer » Thu Feb 07, 2008 8:23 am
have you tried to use the script in the #2 thread ?
regards