function ajax() { include "../../_config.php"; $dt = new Datatables(new MySQL($config), $this); $dt->query("Select film_id, title, description, rating, length from film"); $dt->edit('description', "\$1", 'sample_callback(film_id), strtolower(title)'); echo $dt->generate(); }
<?php require '../../../vendor/autoload.php'; use Ozdemir\Datatables\Datatables; use Ozdemir\Datatables\DB\MySQL; include "../../_config.php"; $dt = new Datatables(new MySQL($config)); $dt->query("Select film.film_id as fid, title, description, rental_rate from film left join film_category on film_category.film_id = film.film_id"); echo $dt->generate();
<?php require '../../../vendor/autoload.php'; use Ozdemir\Datatables\Datatables; use Ozdemir\Datatables\DB\MySQL; include "../../_config.php"; $dt = new Datatables(new MySQL($config)); $dt->query("Select film_id as fid, title, description from film where film_id > 47 and film_id < 83"); echo $dt->generate();
<?php require '../../../vendor/autoload.php'; use Ozdemir\Datatables\Datatables; use Ozdemir\Datatables\DB\MySQL; include "../../_config.php"; $dt = new Datatables(new MySQL($config)); $dt->query("Select film_id, title, description from film"); echo $dt->generate();
<?php require '../../../vendor/autoload.php'; use Ozdemir\Datatables\Datatables; use Ozdemir\Datatables\DB\MySQL; include "../../_config.php"; $dt = new Datatables(new MySQL($config)); $dt->query("Select film.film_id as fid, title, description, concat( rental_rate, ' count:', count(rental_rate)) as rentalcount from film left join film_category on film_category.film_id = film.film_id group by rental_rate"); echo $dt->generate();
<?php require '../../../vendor/autoload.php'; use Ozdemir\Datatables\Datatables; use Ozdemir\Datatables\DB\MySQL; # 300k data example. # http://dev.mysql.com/doc/employee/en/employees-installation.html $config = ['host' => 'localhost', 'port' => '3306', 'username' => 'homestead', 'password' => 'secret', 'database' => 'employees']; $dt = new Datatables(new MySQL($config)); $dt->query("SELECT first_name, last_name, birth_date bd FROM employees;"); echo $dt->generate();
<?php require '../../../vendor/autoload.php'; use Ozdemir\Datatables\Datatables; use Ozdemir\Datatables\DB\MySQL; include "../../_config.php"; $dt = new Datatables(new MySQL($config)); $dt->query("Select film_id, title, description from film"); $dt->edit('title', "\$2 - \$1", 'editurl(film_id, edit), strtolower(title), title'); $dt->edit('description', '$1...', 'substr(description,0,25)'); echo $dt->generate(); function editurl($id, $text) { return '<a href="#' . $id . '">' . $text . '</a>'; }