/ LJCPHPCodeDoc / LJCHTMLTableLib / LJCHTMLTable / ResultHTML


Parameters
$dataItems - The array of row arrays.
$textState - The text state object.
$maxRows - The number of rows to display.

Returns

The HTML table.

Syntax

PHP
public function ResultHTML(array $rows, LJCTextState $textState): string

Create an HTML table from result rows.

Example

PHP
 declare(strict_types=1);
 include_once "LJCRoot.php";
 $prefix = RelativePrefix();
 include_once "$prefix/LJCPHPCommon/LJCDataManagerLib.php";
 include_once "$prefix/LJCPHPCommon/LJCTextBuilderLib.php";
 include_once "$prefix/LJCPHPCommon/LJCHTMLTableLib.php";
 // LJCDataManagerLib: LJCConnectionValues, LJCDataManager
 // LJCTextBuilderLib: LJCAttribute, LJCAttributes, LJCTextBuilder
 //   , LJCTextState
 // LJCHTMLTableLib: LJCHTMLTable
 
 // Get Result table.
 private static function GetResultsTable(LJCTextState $textState)
 {
   $database = "DatabaseName";
   $userID = "UserID";
   $password = "Password";
   $connectionValues = new LJCConnectionValues("localhost", $database, $userID
     , $password);
   $tableName = "Province";
   $manager = new LJCDataManager($connectionValues, $tableName);
 
   // Retrieves all column values.
   $rows = $manager->Load();
 
   $propertyNames = $manager->PropertyNames();
   $ht = new LJCHTMLTable();
   $ht->ColumnNames = $propertyNames;
   $tb = new LJCTextBuilder();
   $ht->TableAttribs = $tb->TableAttribs();
   $result = $ht->ResultHTML($rows, $textState);
 }

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.