Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined('DATATABLES')) exit(); // Ensure being used in DataTables env.
- // Enable error reporting for debugging (remove for production)
- error_reporting(E_ALL);
- ini_set('display_errors', '1');
- $table = 'critical_mount_point';
- // Table's primary key
- $primaryKey = 'mp_sno';
- // Array of database columns which should be read and sent back to DataTables.
- // The `db` parameter represents the column name in the database, while the `dt`
- // parameter represents the DataTables column identifier. In this case simple
- // indexes
- $columns = array(
- array( 'db' => 'system_name', 'dt' => 0 ),
- array( 'db' => 'mountpoint_name', 'dt' => 1 ),
- array( 'db' => 'total_size', 'dt' => 2),
- array( 'db' => 'used_size', 'dt' => 3),
- array( 'db' => 'remaining_size', 'dt' => 4),
- array( 'db' => 'percentage_filled', 'dt' => 5),
- array( 'db' => 'write_permission', 'dt' => 6),
- array(
- 'db' => 'date',
- 'dt' => 7,
- 'formatter' => function( $d, $row ) {
- return date( 'Y-m-j h:i:s A T', strtotime($d));
- })
- );
- // SQL server connection information
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Database user / pass
- */
- $sql_details = array(
- "type" => "Postgres", // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle"
- "user" => "username", // Database user name
- "pass" => "password", // Database password
- "host" => "127.0.0.1", // Database host
- "port" => "5432", // Database connection port (can be left empty for default)
- "db" => "databasename", // Database name
- "dsn" => "", // PHP DSN extra information. Set as `charset=utf8mb4` if you are using MySQL
- "pdoAttr" => array(), // PHP PDO attributes array. See the PHP documentation for all options
- );
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * If you just want to use the basic configuration for DataTables with PHP
- * server-side, there is no need to edit below this line.
- */
- require( 'ssp.class.php' );
- echo json_encode(
- SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
- );
Add Comment
Please, Sign In to add comment