When I run this script the first record in the table is missed out (it assumes the second row in the table is the first). Here it is;
<html>
<head>
<style type="text/css">
body {
font-family : Trebuchet MS, Verdana, Arial, Sans-Serif;
}
</style>
</head>
<body>
<?PHP
// Connect to DB
$db = mysql_connect("localhost", "root");
// Select to DB
mysql_select_db("stradbrokep",$db);
// Set Select all SQL query
$sql = "SELECT * FROM articles";
// Execute Select all SQL query
$result = mysql_query("SELECT * FROM articles",$db);
// Put Results into array
$myrow = mysql_fetch_array($result);
// Print start of table
print("<center><table width=\"650\" cellpadding=\"0\" cellspacing=\"0\">\n");
// While loop
while ($myrow = mysql_fetch_array($result)) {
// Put format of printf into a variable
$format = "<tr bgcolor=\"#d6e7ff\" height=\"30\"><td>  <a href=\"viewarticle.php?articleid=%s\">%s</a>  Submitted by %s on %s</tr>\n";
// Print out the row
printf($format, $myrow['id'], $myrow['title'], $myrow['author'], $myrow['date']);
// Truncate the body into a 330 character long preview
$body = substr($myrow['body'], 0, 330);
// Print the body
print("<tr><td bgcolor=\"#9ec8ff\">$body ...<br /><br /></td></tr><tr><td><br /></td></tr>\n");
}
// Print the table closure
print("</table></center>");
?>
</body>
</html>
Any suggestions why this happens?