I have staging and live environment for my project. On staging env my code is working fine, but on live it's not working. (both servers have php 5.6 running)
My problem is that Datatables Editor backend script is returning blank white page without errors. I have tested that if I have small amount of records in DB ( like 5-10 records ), it's loading everything right.
Backend script:
<?php
include( "../classes/datatables/DataTables.php" );
// Alias Editor classes so they are easy to use
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'translate' )
->fields(
Field::inst( 'id' ),
Field::inst( 'alias' )->validator( 'Validate::notEmpty' ),
Field::inst( 'lv' ),
Field::inst( 'ru' ),
Field::inst( 'en' ),
Field::inst( 'translated' )
->setFormatter( function ( $val, $data, $opts ) {
return ! $val ? 0 : 1;
} )
)
->process( $_POST )
->json();
am I missing any php library I don't know, what could be a problem?
OMG! Took 2 days and found solution, needed to add "charset=utf8" to dsn!
$sql_details = array(
"type" => "Mysql", // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle"
"user" => DB_LOGIN, // Database user name
"pass" => DB_PASS, // Database password
"host" => DB_HOST, // Database host
"port" => 3306, // Database connection port (can be left empty for default)
"db" => DB_DB, // Database name
"dsn" => "charset=utf8" // PHP DSN extra information. Set as `charset=utf8` if you are using MySQL
);