$link = mysql_connect("127.0.0.1", "root", "sturbos") or die("Could not connect: " . mysql_error());
mysql_select_db("dialup") or die("Could not select database
");
$query = "SELECT nxx,xxxx,town FROM numbers ORDER by nxx";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
echo "\n";
echo "\t\n";
echo "First Three Digits | ";
echo "Last Four Digits | ";
echo "Town | ";
echo "
\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t\n";
foreach ($line as $col_value) {
echo "\t\t| $col_value | \n";
}
echo "\t
\n";
}
echo "
\n";
/* Free resultset */
mysql_free_result($result);
/* Closing connection */
mysql_close($link);
?>