PHP read DBF, but no CDX file with the same name

Source: Internet
Author: User
Tags sql error
PHP DBF CDX

PHP Read folder under DBF file, if the same name as the CDX file exists, read no problem,
However, if only the independent DBF file, read through PHP, the error is as follows:

$add = ' C://batman//daten//ladertyp. DBF ';
$e = "Driver={microsoft Visual FoxPro Driver}; SOURCETYPE=DBF; Sourcedb= ". $add."; ";
$odbc =odbc_connect ($e, ', ');

Echo $add;
$query = "SELECT * from". $add. ";";

$result _id = Odbc_do ($odbc, $query);
Odbc_result_all ($result _id, "Border=1 width=50%");
Odbc_close ($ODBC);
?>

The error is as follows:
C://batman//daten//ladertyp. Dbf
WARNING:ODBC_DO (): SQL error: [MICROSOFT][ODBC Visual FoxPro driver]not a table., SQL state S0002 in SQLExecDirect in \ c Xampp\htdocs\dbf.php on line 9

Warning:odbc_result_all () expects parameter 1 to BES resource, boolean given in C:\xampp\htdocs\dbf.php on line 10

May I ask the following: What's the reason? And how to solve it??


Reply to discussion (solution)

Sorry, just tested another file, only dbf file, but no CDX file, with the same instructions can be opened.

The problem is not estimated under the CDX file. What would be the problem?

Seek the guidance of the Great God!! It's a nasty death.

CDX file is a dbf inline index file
If it had been, then deleted, then DBF will not open
You can build an empty file to impersonate

Thank you very much for replying so soon.

I tested the next, or not. The same error.

What would happen if it weren't for CDX?

Find out why. Because the DBF file type is different, the VFP version used is different, and ODBC can support up to 7

Later, OLE DB driver with ADODB plus VFP can be connected.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.