<div id="updates" class="boxed">
	<h2 class="title">Naposledy pridané</h2>
	<div class="side_content">
		
	<?php

		$link = connect_db();
		$sql = "SELECT * FROM books ORDER BY date_added DESC LIMIT 3;";
		$result = mysql_query($sql, $link);
		if ($result) {
			while ($row = mysql_fetch_assoc($result)) {
				echo '<ul><li>';
				echo '<h3><img src="images/timeicon.gif" alt="date updated" /> ' . $row['date_added'] . '</h3>';
				echo '<p><a href="book_list.php">' . $row['name'] . ', <br/><i>' . $row['author'] . '</i></a></p>';	
			}
			mysql_free_result($result);
		} else {
			echo '<p id="red">Nastal problém pri získavaní údajov z databázy - ' . mysql_errno($link) . ': ' . mysql_error($link) . '</p>';
		}
		mysql_close($link);

	?>
		
	</div>
</div>
