I revised your code a bit:
<?php
include ("connect.php");
$query = mysql_query("SELECT id, title FROM content ORDER by id DESC LIMIT 5");
while( $row = mysql_fetch_array( $query ) )
{
echo "<a href='articles.php?var=" . $row['id'] . "'>" . $row['title'] . "</a>";
}
?>
Your major mistake was right here:
echo '<a href="articles.php?var="'
When echoed it actully does this:
<a href="articles.php?var"XXX">
It cuts of the url right after var, so it never actully puts the right link.