GetHTML() public method

This function returns the last query as an HTML table
public GetHTML ( boolean $showCount = true, string $styleTable = null, string $styleHeader = null, string $styleData = null ) : string
$showCount boolean (Optional) TRUE if you want to show the row count, FALSE if you do not want to show the count
$styleTable string (Optional) Style information for the table
$styleHeader string (Optional) Style information for the header row
$styleData string (Optional) Style information for the cells
return string HTML containing a table with all records listed
Beispiel #1
0
        }
    }
    //finish suppcode check
    $sql = "SELECT prodgroup FROM hkmatrix WHERE uid = " . $i;
    $results = $db->QuerySingleRowArray($sql);
    $pgcode = $results[0];
    if ($pgcode) {
        $sql2 = "SELECT hkcategory, wwwcategory FROM categories WHERE code = '" . $pgcode . "'";
        //print $sql2."<br>";
        $subresults = $db->Query($sql2);
        if (!empty($subresults)) {
            $ns = $db->fetchRow($subresults);
            //print_r($ns);
            if ($ns[1]) {
                $newsupp = $db->clean($ns[1]);
            } else {
                $newsupp = $db->clean($ns[0]);
            }
            $sql3 = "UPDATE hkmatrix SET prodgroup ='" . $newsupp . "' WHERE uid = " . $i;
            //print "<br> $sql3";
            $results = $db->Query($sql3);
        }
    }
    // end pgcode check
}
if ($cli == 0) {
    $sql = "SELECT * FROM hkmatrix";
    $newresults = $db->Query($sql);
    print $db->GetHTML(false, 'width:100%;', 'font-size:10px;color:#000;background:#cc0;', 'font-size:9px;color:#000;border-width:1px;border-style:solid;');
    echo '<br>All imported. It is safe to close this tab and continue with import.<input type="button" value="Close" onclick="window.close()" /><br>';
}
Beispiel #2
0
}
echo "Last ID inserted was: " . $db->GetLastInsertID();
// --- Or insert a new record with transaction processing -----------
$sql = "INSERT INTO Test (Color, Age) Values ('Blue', 3)";
$db->TransactionBegin();
if ($db->Query($sql)) {
    $db->TransactionEnd();
    echo "Last ID inserted was: " . $db->GetLastInsertID() . "<br /><br />\n";
} else {
    $db->TransactionRollback();
    echo "<p>Query Failed</p>\n";
}
// --- Query and show the data --------------------------------------
// (Note: $db->Query also returns the result set)
if ($db->Query("SELECT * FROM Test")) {
    echo $db->GetHTML();
} else {
    echo "<p>Query Failed</p>";
}
// --- Getting the record count is easy -----------------------------
echo "\n<p>Record Count: " . $db->RowCount() . "</p>\n";
// --- Loop through the records -------------------------------------
while ($row = $db->Row()) {
    echo $row->Color . " - " . $row->Age . "<br />\n";
}
// --- Loop through the records another way -------------------------
$db->MoveFirst();
while (!$db->EndOfSeek()) {
    $row = $db->Row();
    echo $row->Color . " - " . $row->Age . "<br />\n";
}
Beispiel #3
0
// The rest of this tutorial covers addition methods of getting to the data
// and is completely optional.
// =========================================================================
echo "<hr />\n";
// ---------------------------------------------------------
// Loop through the records using a counter and display the values
for ($index = 0; $index < $db->RowCount(); $index++) {
    $row = $db->Row($index);
    echo "Index " . $index . ": ";
    echo $row->Color . " and " . $row->Age . "<br />\n";
}
echo "<hr />\n";
// ---------------------------------------------------------
// Now let's just show all the data as an HTML table
// This method is great for testing or displaying simple results
echo $db->GetHTML(false);
echo "<hr />\n";
// ---------------------------------------------------------
// Now let's grab the first row of data as an associative array
// The paramters are completely optional. Every time you grab a
// row, the cursor is automatically moved to the next row. Here,
// we will specify the the first row (0) to reset our position.
// We will also specify what type of array we want returned.
$array = $db->RowArray(0, MYSQL_ASSOC);
// Display the array
echo "<pre>\n";
print_r($array);
echo "</pre>\n";
echo "<hr />\n";
// ---------------------------------------------------------
// And now show the individual columns in the array