open dbf files

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

Post Reply
bouncer
Forum Contributor
Posts: 162
Joined: Wed Feb 28, 2007 10:31 am

open dbf files

Post by bouncer »

what is wrong with this code ?
i cant open the file, dont know why, can someone help me ?

Code: Select all

$db = @dbase_open('Exist.dbf', 0);

if ($db) {
  $record_numbers = dbase_numrecords($db);
  for ($i = 1; $i <= $record_numbers; $i++) {
         echo $record_numbers[$i];
  }
}
thanks in advance
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

remove the @ and let the script start with

Code: Select all

error_reporting(E_ALL);
ini_set('display_errors', true);
bouncer
Forum Contributor
Posts: 162
Joined: Wed Feb 28, 2007 10:31 am

Post by bouncer »

if i remove @ appeas this:

" Fatal error: Call to undefined function dbase_open() "

thanks in advance
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

You need the dbase extension. How you get, install and load it depends on the webserver's os.
bouncer
Forum Contributor
Posts: 162
Joined: Wed Feb 28, 2007 10:31 am

Post by bouncer »

are you talking about the dbase.dll ???
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

If it's a win32 server then I'm talking about php_dbase.dll
bouncer
Forum Contributor
Posts: 162
Joined: Wed Feb 28, 2007 10:31 am

Post by bouncer »

yes is a win32, and i already have that dll
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Having is one thing, telling php to use it the other.
see http://de2.php.net/manual/en/install.wi ... nsions.php
bouncer
Forum Contributor
Posts: 162
Joined: Wed Feb 28, 2007 10:31 am

Post by bouncer »

i have already done that....and nothing :?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

You did it wrontg. Check again.
bouncer
Forum Contributor
Posts: 162
Joined: Wed Feb 28, 2007 10:31 am

Post by bouncer »

it's everything fine...dont understand...in php.ini-dist and php.ini-recommended files i have uncomment extension=php_dbase.dll
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

call <?php phpinfo(); ?> and see which php.ini is used. This file you have to edit. Don't forget to restart the webserver (software) when you're done.
bouncer
Forum Contributor
Posts: 162
Joined: Wed Feb 28, 2007 10:31 am

Post by bouncer »

ok, i'll go check that

thanks in advance
Post Reply