When I run this script it connects to the db ok and seems to fetch, but is not displaying correctly. Any ideas?
Here is the source that I get after running code. There is currently two records in the database.
<HTML>
<body>
<table border=1>
<tr><td>Name:</td><td>Email:</td></tr>
<tr><td></td><td><a href="mailto:"></a></td></tr>
<tr><td></td><td><a href="mailto:"></a></td></tr>
</table>
<body>
</HTML>
Code:
<?php
$db = mysql_connect("host", "user", "pass");
mysql_select_db("test",$db);
$result = mysql_query("SELECT * FROM email", $db);
if ($myrow = mysql_fetch_array($result)) {
echo "<table border=1>\n";
echo "<tr><td>Name:</td><td>Email:</td></tr>\n";
do {
printf("<tr><td>%s</td><td><a href=\"mailto:%s\">%s</a></td></tr>\n", $myrow["name"], $myrow["email"], $myrow["email"]);
} while ($myrow = mysql_fetch_array($result));
echo "</table>\n";
} else {
echo "Sorry no records were found!";
}
?>