Location: PHPKode > projects > Matt's March Madness > trunk/index.php
<?php
include("header.php");
include("admin/functions.php");
 
$query = "SELECT * FROM `blog` ORDER BY id DESC LIMIT 3";
$blog = mysql_query($query,$db);

$query = "SELECT c.time, c.content, c.time, c.from, c.bracket, b.name, b.person  FROM `comments` c, `brackets` b WHERE b.id = c.bracket ORDER BY c.time DESC";
$comments = mysql_query($query,$db);

if($blog == NULL) {
	echo "Please <a href=\"admin/install.htm\">configure the site <br />
               AFTER loading structure.sql from the admin directory into a clean database<br />
               and setting up admin/database.php to point to it.</a>\n";
	exit();
}
?>
	
		<div id="main">
			<div id="smacktalk">
			<h2>Latest Smack Talk</h2>
			<div class='messages'>
			
			
			<table width="100%">
			<?php
				while ($post = mysql_fetch_array($comments))
				{					
					echo "<tr><td><span class='postername' >".$post['from'].":</span> <a class='teaser' href=\"view.php?id=" . $post['bracket'] . "#comments\">" . substr($post['content'],0,250);
						
					if (strlen($post['content'])>250)
					{
						echo "...";
					}					
					
					echo "</a><div class='bracketName'><a href=\"view.php?id=" . $post['bracket'] . "#comments\">" . stripslashes($post['name']) . "</a> - <span class='date'>" . timeBetween(strtotime($post['time']),time()) . "</span></div></td></tr>\n";

				}
			?>
			</table>
			</div>
			</div>
			<div class="right_side">
				<?php include("sidebar.php"); ?>
			</div>
			<div class="left_side">
				<?php
                if(isset($_SESSION['success'])) {
				?>
                <div class="success"><?=$_SESSION['success']?></div>
				<?php
				}
				if(isset($_SESSION['errors'])) { 
				?>
                <div class="errors"><p><em>Errors:</em></p><?=$_SESSION['errors']?></div>
				<?php
				}
				unset($_SESSION['errors']);
				unset($_SESSION['success']);
				
				while ($post = mysql_fetch_row($blog)){
					echo "<h2>$post[1]</h2>\n";
					echo "<h3>$post[2]</h3>\n";
					echo "$post[3]\n";
					echo "<p class=\"date\">$post[4]</p>\n";
				}
			?>
				<br />
			</div>
			
		</div>
		
		<div id="footer">
		</div>
	</div>
</body>
</html>
Return current item: Matt's March Madness