<?php
$result = sesam_query("SELECT * FROM phone\n" .
" WHERE LASTNAME='" . strtoupper($name) . "'\n".
" ORDER BY FIRSTNAME", 1);
if (!$result) {
/* ... error ... */
}
// print the table:
echo "<table border=\"1\">\n";
while (($row = sesam_fetch_array($result)) && count($row) > 0) {
echo "<tr>\n";
echo "<td>" . htmlspecialchars($row["firstname"]) . "</td>\n";
echo "<td>" . htmlspecialchars($row["lastname"]) . "</td>\n";
echo "<td>" . htmlspecialchars($row["phoneno"]) . "</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
sesam_free_result($result);
?>