<?php
//include top of the page
include_once('top.php');

// main
echo '<div id="news">';
$sql = 'SELECT * FROM news, people WHERE news.author_id = people.person_id ORDER BY date DESC LIMIT 1';
$result = $db->query($sql);
$row = $result->fetch_assoc();
echo '<div class="one-news">';
echo '<p class="date">'.date('d F Y', strtotime($row['date'])).'</p>';
echo '<h2>'.$row['title'].'</h2>';
echo '<p class="text">'.$row['text'].'</p>';
echo '<p class="author">&mdash; <span>';
echo $row['nickname'] ? $row['nickname'] : $row['first_name'].' '.$row['last_name'];	
echo '</span></div>';
echo '<p id="more"><a href="news.php">more news &gt;&gt;</a></p>';
echo '</div>';
$sql = 'SELECT picture FROM fliers WHERE event_id='.$lastevent['event_id'].' AND side="front"';
$result = $db->query($sql);
$row = $result->fetch_assoc();
if($row['picture']) {
	echo '<div id="next-event">';
	echo '<h2><a href="events.php?event_id='.$lastevent['event_id'].'">'.date('d F Y', strtotime($lastevent['date'])).'</a></h2>';
	echo '<img src="'.$row['picture'].'" alt="last flier" />';
	echo '</div>';
}

//include bottom
include_once('bottom.php');
?>
