This might be what you want:
<html>
<head>
<title>View News</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$link = @mysql_connect(localhost, username, password)
OR exit('Error connecting to the database: ' . mysql_error());
$db = @mysql_selectdb('mydatabase')
OR exit('Error selecting database: ' . mysql_error());
$query = "SELECT id, headline, timestamp FROM news ORDER BY timestamp DESC";
$result = @mysql_query($query)
OR exit('Error selecting news: ' . mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_object($result))
{
?>
<font size="-1"><b><?php echo $row->headling; ?></b> <i><?php echo formatDate($row->timestamp); ?></i></font>
<?php
}
} else {
?>
<font size="-2">No news in the database</font>
<?php
}
mysql_close($link);
?>
</body>
</html>
There's a missing "<?php" where your PHP code starts, while $mysql_error() is most probably mysql_error(), unless you happen to have a variable $mysql_error whose value is the name of a defined function.
As for your parse error, it is due to the code block for the "if" not being closed before you start the code block for the corresponding "else".
The closing brace that you saw is actually the one that closes the while loop within the "if" block.