PHP code example of emagombe / datatable

1. Go to this page and download the library: Download emagombe/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/ */

    

emagombe / datatable example snippets




use emagombe\DataTable;

$sql = "SELECT * FROM table;";
$stmt = $conn->prepare($sql);

$dt = DataTable::create($stmt)->build();
echo $dt; 

use emagombe\DataTable;

$array = [];
$dt = DataTable::create($array)->build();
echo $dt;

DataTable::create($result)->stream();

$dt = DataTable::create($result)->addColumn("action", function($row) {
	return "<b>".$row["name"]."</b>";
})->build();