S
S
Sergey Belyakov2019-03-23 14:48:58
Yii
Sergey Belyakov, 2019-03-23 14:48:58

How to upload to dbf using php?

Hello! I need to upload a table from mysql to dbf file with dbf file structure:

Field nameField typeWidthFraction part
CODE_MOcharacter5
KUSLcharacterfifteen
DATNDateeight
DATODateeight
TARIFNumericten2

How to do it? I have never done this in php before. Yes, and with Yii I'm just getting acquainted. There is a link to this thread, but it doesn't work for me. The test case is like this:
<?php

// база данных "definition"
$def = array(
  array("date",     "D"),
  array("name",     "C",  50),
  array("age",      "N",   3, 0),
  array("email",    "C", 128),
  array("ismember", "L")
);

// создаем
if (!dbase_create('/tmp/test.dbf', $def)) {
  echo "Ошибка, не получается создать базу данных\n";
}

?>

Yii writes that there is no such function:
PHP Fatal Error – yii\base\ErrorException
Call to undefined function app\controllers\dbase_create()

Adding the dll library does not work, I don't know why, I add it to the C:\OSPanel\modules\php\PHP-5.6\ext folder, I connect it in php.ini: extension=php_dbase.dll
How can I unload the database table into dbf?
Thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikolai Konyukhov, 2019-03-23
@grey_18_08

You won't be able to create any dbf without installing the dbase dll.
Here is the dbase extension under win php, select the necessary one (TS / NTS, you can find out by typing php -v, in the console 5c963627aa288808258581.png), add it to ini, then call the extension functions

V
Vladimir, 2021-08-31
@kosenka

https://github.com/luads/php-xbase

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question