Location: PHPKode > scripts > LQueryBU > LQueryBU/query_units/examples/units/getCountries.php
====QUERY====
SELECT SQL_CALC_FOUND_ROWS *,0 as Population_avg FROM Country
WHERE $RECORD->WHERE 
ORDER BY [ORDER_BY] $ASCDESC
LIMIT [LIMIT_FROM],[LIMIT_TO]

====PRE_FORMAT_FIELDS====
<?php 
// Before to eval QUERY, you can check or assign here any variable

if ($RECORD->LIMIT_FROM < 0)
	$RECORD->LIMIT_FROM = 0;

if (!isset($RECORD->WHERE))
	$RECORD->WHERE = "1=1";
	
	if ($RECORD->ASCDESC == 1)
	    $ASCDESC = "ASC";
	else
	    $ASCDESC = "DESC";
?>
====POST_FORMAT_FIELDS====
<?php
// Yo can add here any post action to be executed for all records, 
// or add any field or summary

$RECORD->Population_avg = number_format($RECORD->Population / ($RECORD->SurfaceArea*1000),4);
?>
====POST_FORMAT_FIELDS_NO_RECORDS_FOUND====
<?php 

?>
====POST_SQL_COMMANDS_OK====
PHP: <?php ?>
SQL
====POST_SQL_COMMANDS_KO====
PHP: <?php ?>
SQL:
====POST_SQL_COMMANDS_NO_RECORDS_FOUND====
PHP: <?php ?>
SQL:
Return current item: LQueryBU