I use datatables. I use it in conjunction with a Postgresql server. I want to take the data from the Postgresql server. I use the script found on: http://datatables.net/development/server-side/php_postgres
The script works and creates the json file. The problem is that the values on the json file are null.
This is what it returns:
{"sEcho":1, "iTotalRecords":4, "iTotalDisplayRecords":4, "aaData":[[null,null,null], [null,null,null], [null,null,null], [null,null,null]]}
Also what i don't understand is the variable $sIndexColumn
(Indexed column (used for fast and accurate table cardinality)). I have set its value to the first column of my table e.g. $sIndexColumn = "'Name'";
. Is this the correct use ?
Thanks in advance.
The documentation says:
Emphasis mine. So,
$sIndexColumn
should be a column name, not a quoted string. Try this:Single quotes are used for strings in PostgreSQL (and most other flavors of SQL).
I'm guessing that you made the same quoting problem with your
$aColumns
, i.e. you did something like this:when you should have done something like this:
You're getting three columns out but there's nothing in those columns and those column values come from here:
So if
$aColumns
is wrong then you'll get thenull
s that you're seeing.