Hello Guys
I am new to PHP and I am trying to write a program that imports a csv file into db2 database. Here is my code and the error I get. I hope you can help. You know the first few days of a learning a language is crucial. (:
Error:
Fatal error: Call to undefined function: dba_open() in E:\HTTPD\HTDOCS\csv.php on line 23
Code:
<?php
echo \"Start OK\";
echo \"Start OK2\";
function csv_import() {
global $dbpath, $dbtype, $vars;
$dbpath=\"tst.db\";
$dbtype=\"db2\";
echo \"$dbpath\";
$db=dba_open($dbpath, \"c\", $dbtype, \"0644\");
if($db) {
echo \"db open ok\";
}
if(!$db) {
echo \"db open faild\";
return -1;
}
$fp=fopen(\"e:\httpd\htdocs\tst.csv\",\"r\");
if (!fp){
dba_close($db);
echo \"cannot open csv file\";
return -1;
}
if ($db & $fp){
fclose($fp);
dba_sync($db);
dba_close($db);
echo \"Success\";
}
}
csv_import();
?>