JSON Data display ?????? (thai languege) from server-side php

JSON Data display ?????? (thai languege) from server-side php

srattha@hitt.hitachi-asia.comsrattha@hitt.hitachi-asia.com Posts: 5Questions: 2Answers: 0
edited July 2021 in DataTables 1.10

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
My Data

[
"10",
"HMO062100005",
"MOTOR",
"7.5kW10HPTFOA-LKK6P6P",
"000000000",
"???????",
"28 Jun 21",
"Rattha Sirisukha",
"610 ???? 9 ??????????????-????? (?.?.12) ??????????? ???????????????? ????????????????? 25110 ?????????",
"081-123-4567",
"srattha@hitachi-itt.co.th",
]

Code

<?php
/*
 * DataTables example server-side processing script.
 *
 * Please note that this script is intentionally extremely simple to show how
 * server-side processing can be implemented, and probably shouldn't be used as
 * the basis for a large complex system. It is suitable for simple use cases as
 * for learning.
 *
 * See http://datatables.net/usage/server-side for full details on the server-
 * side processing requirements of DataTables.
 *
 * @license MIT - http://datatables.net/license_mit
 */

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Easy set variables
 */

// DB table to use
$table = 'data_claims_v';

// Table's primary key
$primaryKey = 'id';

// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(
    array( 'db' => 'id', 'dt' => 0 ),
    array( 'db' => 'waranty_no',  'dt' => 1 ),
    array( 'db' => 'product',   'dt' => 2 ),
    array( 'db' => 'model',     'dt' => 3 ),
    array( 'db' => 'mfg_no',     'dt' => 4 ),
    array( 'db' => 'mo_installation',     'dt' => 5 ),
    array(
        'db'        => 'purchase_date',
        'dt'        => 6,
        'formatter' => function( $d, $row ) {
            // return date( 'jS M y', strtotime($d));
            return date( 'd M y', strtotime($d));

        }
    ),
    array( 'db' => 'name',     'dt' => 7 ),
    array( 'db' => 'address',     'dt' => 8 ),
    array( 'db' => 'phone_number',     'dt' => 9 ),
    array( 'db' => 'email',     'dt' => 10 ),

);

// SQL server connection information
$sql_details = array(
    'user' => '***',
    'pass' => '***',
    'db'   => 'dbname',
    'host' => 'localhost',
    'charset' => 'utf8'
);


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * If you just want to use the basic configuration for DataTables with PHP
 * server-side, there is no need to edit below this line.
 */

require( '../ssp.class.php' );

echo json_encode(
    SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    You haven't said what issue you want help with! We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

Sign In or Register to comment.