Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Halim Halim
Added: Apr 13, 2019 9:18 PM
Views: 15
Tags: datatable
  1. <?php
  2.  
  3. require_once('../config/config.php');
  4. require_once('../classes/Datatables.php' );
  5.  
  6. // DB table to use
  7. $table = 'countries';
  8.  
  9. // Table's primary key
  10. $primaryKey = 'id';
  11.  
  12. // Array of database columns
  13. $columns = array(    
  14.     array('db' => 'id',   'dt' => 0),
  15.     array('db' => 'name', 'dt' => 1)
  16. );
  17.  
  18.  
  19. // SQL server connection information
  20. $sql_details = array(
  21.     'user' => $db_user,
  22.     'pass' => $db_pass,
  23.     'db'   => $db_name,
  24.     'host' => $db_host,
  25. );
  26.  
  27.  
  28.     Datatables::simple($_GET, $sql_details, $table, $primaryKey, $columns)
  29. );
  30.