Source code example for Web Database Applications
Unless otherwise stated, the source code distributed with this book can be
redistributed in source or binary form so long as an acknowledgment appears
in derived source files.
The citation should list that the code comes from Hugh E.
Williams and David Lane, "Web Database Application with PHP and MySQL"
published by O'Reilly & Associates.
This code is under copyright and cannot be included in any other book,
publication, or educational product without permission from O'Reilly &
No warranty is attached; we cannot take responsibility for errors or fitness
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN"
<h1>The Times Tables</h1>
// Go through each table
for($table=1; $table<13; $table++)
echo "<p><b>The " . $table . " Times Table</b>\n";
// Produce 12 lines for each table
for($counter=1; $counter<13; $counter++)
$answer = $table * $counter;
// Is this an even-number counter?
if ($counter % 2 == 0)
// Yes, so print this line in bold
echo "<br><b>$counter x $table = " .
// No, so print this in normal face
echo "<br>$counter x $table = $answer</br>";