I posted PHP connect DBF file with a sample. Now Pierre left the message and asked why error comes up.
I doing some tests and get the answer.
1) The database.dbf is reserved name.
2) The field name is always capital.

Let me give the better sample here.

$strsql= 'SELECT * FROM dat.dbf';
$query = odbc_exec($odbc, $strsql) or die (odbc_errormsg());
while($row = odbc_fetch_array($query))
echo 'Client Name: '.$row['NAME'].'
echo 'Client Phone Number: '.$row['PHONE'].'
echo '<hr />';

David Yin

David is a blogger, geek, web developer. Founder of FreeInOutBoard.com. He check David Yin's Blog everyday. If you like his post, you can say thank you here

One Reply to “PHP connect DBF file update”

  1. i copied and tested the code you provided.. but still i always end up with this error.
    Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC dBase Driver] Syntax error in FROM clause., SQL state 37000 in SQLExecDirect in G:\wamp\www\MAPS\Map for Web 2011\trial.php on line 4
    [Microsoft][ODBC dBase Driver] Syntax error in FROM clause.
    what will i do to solve this problem?

Leave a Reply

Your email address will not be published. Required fields are marked *