I'm trying to use jQuery-jTable to list data from a MS-Access database through PHP. I want to change the sample provided by jTable.org : http://www.jtable.org/downloads/jTable-PHP-Samples.zip
<?php
try { //Open database connection $db_connection = odbc_connect("Persist Security Info=False;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=c:\websiagh\books\54.mdb", "ADODB.Connection", "password", SQL_CUR_USE_ODBC) or die('Cannot connect to 54');
//Getting records (listAction)
if($_GET["action"] == "list")
{
//Get records from database
$query = 'SELECT * FROM asnad WHERE (sanadno Between 10 AND 20 )';
$result = odbc_exec($db_connection , $query );
//Add all records to an array
$rows = array();
while( $row = odbc_fetch_array( $result ) )
{
$rows[] = $row;
}
//Return result to jTable
$jTableResult = array();
$jTableResult['Result'] = "OK";
$jTableResult['Records'] = $rows;
print json_encode($jTableResult);
}
...
The rest of the code is not changed. The code ( query execution and fetching data using odbc ) works well when not using jTable. However when using it in the code as above , I get this error : An error occured while communicating to the server. But when I export the data from MS-Access to mysql, there is no problem at all.