SQLite Version of PHP Processing Code

SQLite Version of PHP Processing Code

pontinopontino Posts: 1Questions: 0Answers: 0
edited November 2013 in DataTables 1.8
Hi to all.. After reading this http://datatables.net/forums/discussion/comment/29981 i created a SQLite Version of PHP Processing page.
I just want to share: [code]<?php

try {
// Set default timezone
date_default_timezone_set('Europe/Rome');

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Easy set variables
*/

/* Array of database columns which should be read and sent back to DataTables. Use a space where
* you want to insert a non-database field (for example a counter or static image)
*/
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );

/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "id";

/* DB table to use */
$sTable = "ajax";

/* Database connection information */
$gaSql['path'] = "database.db3";
$gaSql['password'] = "";
$file_db = null;

// Create (connect to) SQLite database in file
$file_db = new PDO('sqlite:'.$gaSql['path']);
// Set errormode to exceptions
$file_db->setAttribute(PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION);
/*
* Paging
*/
$sLimit = "";
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
{
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
intval( $_GET['iDisplayLength'] );
}


/*
* Ordering
*/
$sOrder = "";
if ( isset( $_GET['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $i

Replies

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin
    Very nice - thanks for sharing this with us! I'm sure others will also find it useful.

    Allan
This discussion has been closed.