在数据表语法上使用“ AS”时出现错误

时间:2019-04-15 09:41:33

标签: php datatables server-side

嗨,我在服务器端数据表上运行“ AS”语法时出错。看下面的代码。

如何在编写此代码的代码中使用“ AS”语法?

位于行上 $ whereAll =“状态以(”,'reply','updated')美国优先级ORDER BY优先级“;

require '../../../manager/config/mainconfig.php';
$Connection = new Connection();
session_start();
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) AND strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    require('../../../manager/lib/ssp.class.php');
    $table = 'tiket';
    $primaryKey = 'id';
    $uname = $_SESSION['user']['username'];

    $columns = array(
        array( 'db' => 'id_tiket', 'dt' => 0),
        array( 'db' => 'judul', 'dt' => 1),
        array( 'db' => 'prioritas', 'dt' => 2),
        array( 'db' => 'departemen', 'dt' => 3),
        array( 'db' => 'status', 'dt' => 4, 'formatter' => function($i) {
            if ($i == 'menunggu') {
                $label = 'warning';
            } elseif ($i == 'ditutup' OR $i == 'Partial') {
                $label = 'danger';
            } elseif ($i == 'dibalas' OR $i == 'diperbarui') {
                $label = 'info';
            } elseif ($i == 'selesai') {
                $label = 'success';
            } else {
                $label = 'warning';
            }
            return '<span class="badge badge-'.$label.'">'.$i.'</span>';
        }),
        array( 'db' => 'tgl_buat', 'dt' => 5),
        array( 'db' => 'tgl_update', 'dt' => 6),
        array( 'db' => 'id_tiket',  'dt' => 7, 'formatter' => function($i,$a) {
                return '<a href="replay?id='.$i.'" class="btn btn-sm btn-info"><i class="fa fa-reply"></i></a>';
        }),
    );
    $sql_details = array(
        'user' => 'root',
        'pass' => '',
        'db'   => 'navpedia',
        'host' => 'localhost'
    );
    $whereResult = "user = 'navaluzer'";
    $whereAll   = "status in ('', 'dibalas', 'diperbarui') AS priority ORDER BY priority";
    print(json_encode(
        SSP::complex( $_GET, $sql_details, $table, $primaryKey, $columns, $whereResult, $whereAll )
    ));
} else {
    exit("Not Access!");
}

0 个答案:

没有答案