PostGres + PHP + DataTables ... "aaData" - Empty!
PostGres + PHP + DataTables ... "aaData" - Empty!
janrusselcalachan
Posts: 10Questions: 0Answers: 0
Hi Allan, I used the same code from your example http://www.datatables.net/development/server-side/php_postgres
but I'm getting confused why is it that the returned "aaData" is empty.
Here's exactly what the response in firebug says:
[code]
{"sEcho":1,"iTotalRecords":3131,"iTotalDisplayRecords":3131,"aaData":[]}
[/code]
and this is my code for retrieving records:
[code]
<?php
/*
* Script: DataTables server-side script for PHP and PostgreSQL
* Copyright: 2010 - Allan Jardine
* License: GPL v2 or BSD (3-point)
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Easy set variables
*/
/* Array of database columns which should be read and sent back to DataTables. Use a space where
* you want to insert a non-database field (for example a counter or static image)
*/
$aColumns = array( '"ID"','"FULLNAME"', '"ENTRYSOURCE"', '"STATUS"', '"DATEADDED"');
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = '"ID"';
/* DB table to use */
$sTable = '"TBLMASTERFILERAW"';
/* Database connection information */
$gaSql['user'] = "";
$gaSql['password'] = "";
$gaSql['db'] = "";
$gaSql['server'] = "";
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
* no need to edit below this line
*/
/*
* DB connection
*/
$gaSql['link'] = pg_connect(
" host=".$gaSql['server'].
" dbname=".$gaSql['db'].
" user=".$gaSql['user'].
" password=".$gaSql['password']
) or die('Could not connect: ' . pg_last_error());
/*
* Paging
*/
$sLimit = "";
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
{
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] )." OFFSET ".
intval( $_GET['iDisplayLength'] );
}
/*
* Ordering
*/
if ( isset( $_GET['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $i $iFilteredTotal,
"aaData" => array()
);
while ( $aRow = pg_fetch_array($rResult, null, PGSQL_ASSOC) )
{
$row = array();
for ( $i=0 ; $i
[/code]
but I'm getting confused why is it that the returned "aaData" is empty.
Here's exactly what the response in firebug says:
[code]
{"sEcho":1,"iTotalRecords":3131,"iTotalDisplayRecords":3131,"aaData":[]}
[/code]
and this is my code for retrieving records:
[code]
<?php
/*
* Script: DataTables server-side script for PHP and PostgreSQL
* Copyright: 2010 - Allan Jardine
* License: GPL v2 or BSD (3-point)
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Easy set variables
*/
/* Array of database columns which should be read and sent back to DataTables. Use a space where
* you want to insert a non-database field (for example a counter or static image)
*/
$aColumns = array( '"ID"','"FULLNAME"', '"ENTRYSOURCE"', '"STATUS"', '"DATEADDED"');
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = '"ID"';
/* DB table to use */
$sTable = '"TBLMASTERFILERAW"';
/* Database connection information */
$gaSql['user'] = "";
$gaSql['password'] = "";
$gaSql['db'] = "";
$gaSql['server'] = "";
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
* no need to edit below this line
*/
/*
* DB connection
*/
$gaSql['link'] = pg_connect(
" host=".$gaSql['server'].
" dbname=".$gaSql['db'].
" user=".$gaSql['user'].
" password=".$gaSql['password']
) or die('Could not connect: ' . pg_last_error());
/*
* Paging
*/
$sLimit = "";
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
{
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] )." OFFSET ".
intval( $_GET['iDisplayLength'] );
}
/*
* Ordering
*/
if ( isset( $_GET['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $i $iFilteredTotal,
"aaData" => array()
);
while ( $aRow = pg_fetch_array($rResult, null, PGSQL_ASSOC) )
{
$row = array();
for ( $i=0 ; $i
[/code]
This discussion has been closed.