DataTables 1.10 serverside sp.class.php
DataTables 1.10 serverside sp.class.php
kqueekquee
Posts: 40Questions: 1Answers: 0
i have this message in serverside
Notice: Undefined index: columns in \ssp.class.php on line 159
Notice: Undefined index: draw in \ssp.class.php on line 245
https://github.com/DataTables/DataTables/blob/master/examples/server_side/scripts/ssp.class.php
Notice: Undefined index: columns in \ssp.class.php on line 159
Notice: Undefined index: draw in \ssp.class.php on line 245
https://github.com/DataTables/DataTables/blob/master/examples/server_side/scripts/ssp.class.php
This discussion has been closed.
Replies
<?php
// MYSQL DB table utilisée
$table = 'communes';
// Clé primaire
$primaryKey = 'INSEE';
// Array des colonnes à lire et à transmettre vers DataTables.
$columns = array(
array( 'db' => 'CRAC', 'dt' => 0 ),
array( 'db' => 'REGION', 'dt' => 1 ),
array( 'db' => 'INSEE', 'dt' => 2 ),
array( 'db' => 'NOM', 'dt' => 3 ),
);
$config = parse_ini_file( $_SERVER['DOCUMENT_ROOT'] . 'config.ini' , true);
// connexion Base de données MYSQL serveur connection information
$sql_details = array(
'user' => $config["BDD"]["identifiant"],
'pass' => $config["BDD"]["motdepasse"],
'db' => $config["BDD"]["nombdd"],
'host' => $config["BDD"]["hote"]
);
require( 'ssp.class.php' );
echo json_encode( SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns ));
?>
Allan
I have the same problem. Have you got solved the problem kqueekquee?
@Muckel - Can you link use to your page so we can debug it and try to provide some assistance please?
Allan
Ahhh... still no answer..... I get stuck with the exact same error (-____-")
Notice: Undefined index: columns in \ssp.class.php on line 159
Notice: Undefined index: draw in \ssp.class.php on line 245
This is how I wrote my server processing code :
http://pastebin.com/wSG3JuBy
And this is the error I get :
http://pasteboard.co/y6zkR0R.jpg
And I didn't change anything from ssp.class.php
Please.. can anyone solve this XD
Looks like many people got stuck in the sama error
The best approach is to provide a link to the page showing the error. (Allan already asked twice.)
Ohh.. thanks fast 4 response.
Errr... I'm sorry, I already read too.. but I'm having trouble upload my page on server for some reasons.
But I'll try. I already attached the page showing the error too as a picture above, please kindly take a look
It was exactly as I mentioned .above, I didn't change ssp.class.php, I just change the processing code (the code I posted before). I'm still working on it too
One thing that does spring to mind - have you use the
serverSide
option to enable server-side processing?Again - with a test case we would have spotted that immediately. You will not receive any further replies for me without a link to a test case.
Thanks,
Allan
I have this exact same Error, I have only edited the default scripts to display my data.
Hi,
I had the same problem but now it works - after a lot of hours. The encoded array from ssp.class.php was not in UTF-8 what is needed for json_encode.
In the ssp.class.php at about #267:
Directly after this you have to place the following:
This solved it for me.
Still i have the same error. while testing the example code which provided in the source zip.
@vkvaradha - Please link to a test case showing the issue.
Allan
i just replied on github issues. help me on this.
Hi,
I had the same problem but now it works - after a lot of hours. The encoded array from ssp.class.php was not in UTF-8 what is needed for json_encode.
In the ssp.class.php at about #267:
$db = @ new PDO(
"mysql:host={$sql_details['host']};dbname={$sql_details['db']}",
$sql_details['user'],
$sql_details['pass'],
array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION )
);
Directly after this you have to place the following:
$db->query("SET NAMES 'utf8'");
This solved it for me.
This did the magic as said by @vivanet
Good to hear - thanks for the feedback.
Allan
Thanks . Merci beaucoup