[SOLVED] SQL field names with hyphen minus
[SOLVED] SQL field names with hyphen minus
fobos
Posts: 14Questions: 0Answers: 0
Hi,
I wanted to compliment the work done on this component. It 'really well done!
But I have a small problem, basically I'm using the example :
http://datatables.net/release-datatables/examples/data_sources/server_side.html
but having the column names with the hyphen (- minus) the output is null, I tried to put the quotes sql but nothing, I can not make a print screen of the values ββin my database. Is there anyone who can help me.
Thanks in advance
I wanted to compliment the work done on this component. It 'really well done!
But I have a small problem, basically I'm using the example :
http://datatables.net/release-datatables/examples/data_sources/server_side.html
but having the column names with the hyphen (- minus) the output is null, I tried to put the quotes sql but nothing, I can not make a print screen of the values ββin my database. Is there anyone who can help me.
Thanks in advance
This discussion has been closed.
Replies
Then run that against your DB using pgMyAdmin or whatever and see what modifications are required (most like assign ` around the field names). If that is the case, then you know what modifications need to be made to the script.
Allan
I changed manually the select query sql inserting quotes.
In the file connector.php I echo the output from all fields, except that I get this error:
DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.
It may be that the error is given by the large number of records in the database. because there are 80 000 records
{
"sEcho": 0,
"iTotalRecords": "81665",
"iTotalDisplayRecords": "1",
"aaData": [
[
"02790",
"1",
"1",
"D01",
"2011-10-04",
null,
"attach.tif"
]
]
}
[/code]
jSON is validate, but in output display this warning :
DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.
I changed manually the select query:
[code]
$sQuery = "
SELECT SQL_CALC_FOUND_ROWS `A-1`, `A-2`, `SHEET`, `REVISION`, `D-IMPORT`,`FILE-NAME`
FROM $sTable
$sWhere
$sOrder
$Desc
$sLimit
";
[/code]
After that for every SQL statement I manually add the quotes that I recommend to any SQL way of putting it.
[code]
/*
* Ordering
*/
if ( isset( $_GET['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $i
I think adding these quotes to the default server-side processing script is probably quote a good idea. I can't see any harm in doing so, so I'll do that soon.
Regards,
Allan