PHP code example of ugo / datatable

1. Go to this page and download the library: Download ugo/datatable library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ugo / datatable example snippets



    li_connection = [YOUR MYSQLI CONNECTION OBJECT];
    $table             = new Datatable($mysqli_connection);
    $data              = $_REQUEST;
    $table_name        = "users";
    $filter            = " AND email = '[email protected]'";
    $pk                = "email";
    $column            = array(
                            array( 'db' => 'username', 'dt' => 0 ),
                            array( 'db' => 'first_name', 'dt' => 1 ),
                            array( 'db' => 'last_name', 'dt' => 2 )
                            array( 'db' => 'username', 'dt' => 3,'formatter'=>function($d,$row){
                                $name = $row['first_name'];
                                return echo "<button>Edit ".$name."</button>";
                            } )
                            );
    $jquery_table = $table->generateTable($data,$table_name,$columner,$filter,$pk);
    var_dump($jquery_table);