[Need help] Example for oracle? JSON data from server could not be parsed.
[Need help] Example for oracle? JSON data from server could not be parsed.
Hello! can i get example of http://www.datatables.net/development/server-side/php_oracle ?
I've tried using the php_oracle code and rename it as server_oracle.php and create oracle.html to display the result. Unfortunately when I tried to run it in my localhost it only succeed connecting to my oracle 11G database, displaying database record, and sorting each table, but when I started to type in the search field, suddenly an error appeared : "JSON data from server could not be parsed. This is caused by a JSON formatting error."
when I execute the server_oracle.php file there are bunch of error warnings:
Warning: oci_bind_by_name() [function.oci-bind-by-name]: ORA-01036: illegal variable name/number in C:\xampp\htdocs\datatables\examples\server_side\scripts\server_oracle.php on line 233
Warning: oci_bind_by_name() [function.oci-bind-by-name]: ORA-01036: illegal variable name/number in C:\xampp\htdocs\datatables\examples\server_side\scripts\server_oracle.php on line 234
Warning: oci_execute() [function.oci-execute]: ORA-30485: missing ORDER BY expression in the window specification in C:\xampp\htdocs\datatables\examples\server_side\scripts\server_oracle.php on line 260
Warning: oci_fetch_array() [function.oci-fetch-array]: ORA-24374: define not done before fetch or execute and fetch in C:\xampp\htdocs\datatables\examples\server_side\scripts\server_oracle.php on line 262
Warning: oci_execute() [function.oci-execute]: ORA-30485: missing ORDER BY expression in the window specification in C:\xampp\htdocs\datatables\examples\server_side\scripts\server_oracle.php on line 281
Warning: oci_fetch_array() [function.oci-fetch-array]: ORA-24374: define not done before fetch or execute and fetch in C:\xampp\htdocs\datatables\examples\server_side\scripts\server_oracle.php on line 284
{"sEcho":0,"iTotalRecords":"92036","iTotalDisplayRecords":0,"aaData":[]}
===================================
By the way, how to create multi_filter in server-side/php_oracle like in datatables/examples/api/multi_filter.html
my php version: 5.2.9
Database: Oracle 11G
Many many thanks for your help!! :)
Best regards,
Dar
I've tried using the php_oracle code and rename it as server_oracle.php and create oracle.html to display the result. Unfortunately when I tried to run it in my localhost it only succeed connecting to my oracle 11G database, displaying database record, and sorting each table, but when I started to type in the search field, suddenly an error appeared : "JSON data from server could not be parsed. This is caused by a JSON formatting error."
when I execute the server_oracle.php file there are bunch of error warnings:
Warning: oci_bind_by_name() [function.oci-bind-by-name]: ORA-01036: illegal variable name/number in C:\xampp\htdocs\datatables\examples\server_side\scripts\server_oracle.php on line 233
Warning: oci_bind_by_name() [function.oci-bind-by-name]: ORA-01036: illegal variable name/number in C:\xampp\htdocs\datatables\examples\server_side\scripts\server_oracle.php on line 234
Warning: oci_execute() [function.oci-execute]: ORA-30485: missing ORDER BY expression in the window specification in C:\xampp\htdocs\datatables\examples\server_side\scripts\server_oracle.php on line 260
Warning: oci_fetch_array() [function.oci-fetch-array]: ORA-24374: define not done before fetch or execute and fetch in C:\xampp\htdocs\datatables\examples\server_side\scripts\server_oracle.php on line 262
Warning: oci_execute() [function.oci-execute]: ORA-30485: missing ORDER BY expression in the window specification in C:\xampp\htdocs\datatables\examples\server_side\scripts\server_oracle.php on line 281
Warning: oci_fetch_array() [function.oci-fetch-array]: ORA-24374: define not done before fetch or execute and fetch in C:\xampp\htdocs\datatables\examples\server_side\scripts\server_oracle.php on line 284
{"sEcho":0,"iTotalRecords":"92036","iTotalDisplayRecords":0,"aaData":[]}
===================================
By the way, how to create multi_filter in server-side/php_oracle like in datatables/examples/api/multi_filter.html
my php version: 5.2.9
Database: Oracle 11G
Many many thanks for your help!! :)
Best regards,
Dar
This discussion has been closed.
Replies
public function Array2aaData($array) {
$out = '{ "aaData": [ ';
if ($array) {
$arrKeys = array_keys($array);
$arrVals = array_values($array);
for ($x = 0; $x <= count($arrVals[0]) - 1; $x++) {
$out .= "[";
for ($i = 0; $i <= count($arrKeys) - 1; $i++) {
$out .= '"' . addslashes($array[$arrKeys[$i]][$x]) . '"';
if (!($i == count($arrKeys) - 1)) {
$out .= ",";
}
}
if (!($i == count($arrVals[0]) -1) || !($i == count($arrVals[0])) ) {
$out .= '],';
}
}
$out = substr($out, 0, strlen($out) - 1);
}
$out .= '] }';
$quebras = array("\n\r", "\n");
return str_replace($quebras, "", $out);
}
Thanks for replying :D
I've tried to use your function in server_processing.php but it still produce errors :(
if it's possible, can you send me your server_processing.php for oracle to darmanto.li@gmail.com ?
Thanks again for your help..sorry for troubling you so much..
Best regards,
Dar
I just use this to generate valid JSON data. Kinda no 'server_processing.php' here ;P