<?php

mysql_connect('127.0.0.1', 'classicmodels', 'Nr4VCCub6NuG8Vzd');
mysql_select_db('classicmodels');

function escape($x) {
        return htmlspecialchars($x, ENT_NOQUOTES, 'UTF-8');
}

for($i = 0; $i < 1000; $i++) {

echo "<h1>Kunden</h1>\n";
echo "<table>\n";
echo "<tr><th>Kunde</th><th>Stadt</th><th>Land</th></tr>\n";
$customers = mysql_query("SELECT customerName, city, country FROM customers ORDER BY customerName");
while($customer = mysql_fetch_assoc($customers)) {
        $name = escape($customer['customerName']);
        $city = escape($customer['city']);
        $country = escape($customer['country']);
        echo "<tr><td>$name</td><td>$city</td><td>$country</td></tr>\n";
}
echo "</table>";


echo "<h1>Produkte</h1>\n";
echo "<table>\n";
echo "<tr><th>Code</th><th>Name</th><th>Anbieter</th></tr>\n";
$products = mysql_query("SELECT productCode, productName, productVendor FROM products ORDER BY productCode");
while($product = mysql_fetch_assoc($products)) {
        $code = escape($product['productCode']);
        $name = escape($product['productName']);
        $vendor = escape($product['productVendor']);
        echo "<tr><td>$code</td><td>$name</td><td>$vendor</td></tr>\n";
}
echo "</table>\n";

}