Quantcast
Channel: DataTables 1.10 — DataTables forums
Viewing all articles
Browse latest Browse all 2364

Render Datatables from 2 tables mysql

$
0
0

Hi,
I want to display a table with some fields have extra queries from another table.
If I do a query inside array as

array(
        'db'   => 'codice',
        'dt'        => 'verifica_cancellata',
        'formatter' => function ($d) {


            $data_in_elaborazione = $_GET["data_in_elaborazione"];

            $connessione = mysqli_connect('localhost', 'xxxxx', 'xxxxx', 'xxxxxxx');
            $cerca_brano = 'BRANO-' . $d;
            $query_usata_storico = "select count(nome_evento) as contatore_storico from playlist_generate where nome_evento = '$cerca_brano' and data_playlist = '$data_in_elaborazione'";
            $esegui_query_usata_storico = $connessione->query($query_usata_storico);

            $risultato_conta  = $esegui_query_usata_storico->fetch_assoc();

            $risultato_contatore = $risultato_conta['contatore_storico'];
            if ($risultato_contatore == '0') {
                // colore verde
                $colore = '0';
            } else {
                //colore nero
                $colore = '1';
            }

            return $colore;
        }

    ),

it works, but the render is very slow. There is an other solution?
thanks


Viewing all articles
Browse latest Browse all 2364

Trending Articles