PClib demo site

<?php
/* project: Basic grid, file: basicgrid.php */

//Include pclib framework
require 'pclib/pclib.php';

//Create pclib application
$app = new PCApp('demo');

$datasource 'mysql://root@localhost/test';

$app->db = new PCDb($datasource);

//Initialize grid template, set grid query and write grid out
$grid = new PCGrid('tpl/sumgrid.tpl');
$grid->setQuery('select * from PRODUCTS order by productLine, productVendor');

//Set summarization query grouped by column productLine
$grid->summary('productLine',
  
"select count(*) N, sum(quantityInStock) sumQ, avg(buyPrice) avgPrice
  from PRODUCTS
  where productLine='[productLine]'"
);

/* Set summarization according to column productVendor, using template
block "vendor". No query here, because we just print vendorname
already present in grid */
$grid->summary('productVendor','','vendor');

print 
$grid;
?>

Elapsed time: 1.81 ms