SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'field list';

SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'field list';

hsoft2020hsoft2020 Posts: 12Questions: 5Answers: 0

Hi.I wrote a code that fetch rows from database and my datatable is server side. SQL statement is correct and I checked it but when I use it returns this error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'field list';

my javascript code is like this:
dtlogs = $('#jobsList').DataTable({

    serverSide: true,
    ajax: 'server_processing.php'+getString,    
    bsortable:false,
aasorting:[],
    order:[], 
});

php serverSideCode:

$table = <<<EOT
 (
select * from company 
 ) temp
EOT;

$primaryKey='id';

$columns = array(
    array( 'db' => 'id','dt' => 0),
    array( 'db' => 'comPanyName','dt' => 1),
    array( 'db' => 'managerName','dt' => 2),
    array( 'db' => 'contact','dt' => 3),
    array( 'db' => 'date','dt' => 4),
    array( 'db' => 'ncode','dt' => 5)

);

and html code:

id comPanyName managerName contact date ncode

I checked everything but I dont understand why I get this error.

Answers

  • allanallan Posts: 61,451Questions: 1Answers: 10,055 Site admin

    For the code shown, there is nothing wrong there that would indicate why you are getting that error.

    In your local copy of the SSP class, uncomment this line and it will cause the SQL that is being executed to be dumped out. You'll get a JSON warning form DataTables, but that doesn't matter - just use the browser's inspector to see what the response from the server is. What does it show?

    Allan

Sign In or Register to comment.