Php reads dbf, but there is no cdx file with the same name

Source: Internet
Author: User
Tags sql error
Php reads dbf, but there is no cdx file with the same name as php dbf cdx

PHP reads the dbf file in the folder. if a cdx file with the same name exists, there is no read problem,
However, if you only have an independent dbf file and read it through PHP, the following error is returned ..

$ 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 following error is reported ..
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 be resource, boolean given in C: \ xampp \ htdocs \ dbf. php on line 10

Excuse me .. Why? How can this problem be solved ??

Reply to discussion (solution)

Sorry, I just tested another file. only the DBF file is available, but there is no cdx file. you can open it with the same command ..

It is estimated that the problem is not in the cdx file .. What is the problem?

Thank you for your guidance !! It's in a hurry ..

The CDX file is an inline index file of dbf.
If it was deleted later, dbf won't be able to open it.
You can create an empty file to impersonate

Thank you very much for replying so soon.

I tested it, but I still cannot .. The same error is reported ..

What would happen if it wasn't about CDX?

Find the cause .. Because DBF has different file types and different VFP versions, ODBC supports up to 7

Later, the plug-in can be connected using the ADODB and VFP oledb drivers ..

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: 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.