Kamis, 28 Agustus 2025

Menambahkan field diluar field tabel pada datatable

if (isset($_GET['search']['value']) && $_GET['search']['value'] != '') {


    $search = $_GET['search']['value'];

    $where_sql .= ' (';

    // create parameter pencarian kesemua kolom yang tertulis

    // di $columns

    for ($i = 0; $i < count($columns); $i++) {

        if ($columns[$i] != 'Kapitalisasi') {

            $where_sql .= $columns[$i] . ' LIKE "%' . $search . '%" ';

        }


        // agar tidak menambahkan 'OR' diakhir Looping

        if ($i < count($columns) - 2) {

            $where_sql .= ' OR ';

        }

        // echo $where_sql;

    }


    $where_sql  .= ' )';

}

// die();


// echo $where_sql;

if (count($where) > 0) {

    $where = join(" and ", $where);

    $where = "where $where ";

} else {

    $where = '';

}

if ($where_sql != '') {

    $sql .= " $where AND $where_sql";

} else {

    $sql .= " $where";

Tidak ada komentar:

Posting Komentar

Concat tidak berfungsi untuk indexing

 $sql = "SELECT a.* , CONCAT(a.Kode_Barang,'<br><b>',b.Nm_Aset5,'</b>') as Nm_Aset5, CONCAT(a.latitud...