PlatinumGrid
develop faster.

For applications written using Delphi For PHP, PlatinumGrid is a drag-and-drop component with complete integration into the VCL For PHP. This page is intended for the developers who do not use Delphi For PHP, to demonstrate the easy API that PlatinumGrid provides.

Custom SQL:
If you need to perform a custom query to generate the data set for PlatinumGrid, this example shows how to do it.
<?php
require_once( '../grid.inc.php' );

$dbConnection mysql_connect'localhost''root''' );

mysql_select_db'gridsamples'$dbConnection );

$dataSource = new MySQLDatasource$dbConnection );
$dataSource->DataSet->QueryCallback 'GenQuery';
$dataSource->DataSet->Open();

function 
GenQuery$dataSet )
{
    
$sql =
        
'SELECT e.FirstName, e.LastName, d.Department ' .
          
'FROM employeestiny e ' .
            
'INNER JOIN departments d ON d.ID = e.DepartmentID';

    if( 
$dataSet->Filter || ( $dataSet->MasterSource && count$dataSet->MasterDetailKeys ) ) )
    {
        
$filter $dataSet->Filter;

        if( 
$dataSet->MasterSource && count$dataSet->MasterDetailKeys ) )
        {
            foreach( 
$dataSet->MasterDetailKeys as $detailKey => $masterKey )
            {
                if( 
$filter )
                    
$filter .= ' AND ';

                
$filter .= "$detailKey = " .
                    
$dataSet->Database->QuoteStr$dataSet->MasterSource->DataSet->Fields$masterKey ] );
            }
        }

        if( 
$filter )
            
$sql .= ' WHERE ' $filter;
    }

    if( 
$dataSet->OrderField )
        
$sql .= ' ORDER BY ' $dataSet->OrderField;

    return 
$sql;
}

// Construct the grid.
$grid = new JTPlatinumGrid();
$grid->Datasource $dataSource;
$grid->Height '';
$grid->SiteTheme->Theme 'default';

$grid->init();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>Basic Demo</title>
<?php
$grid
->dumpHeaderCode();
?>
</head>
<body>
  <h1>Basic Demo</h1>
  <form action="" method="post">
    <div id="<?php echo( $grid->Name ); ?>_outer">
<?php $grid->dumpContents(); ?>
    </div>
  </form>
</body>
</html>