Location: PHPKode > projects > MegaBB > index.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="default.css">


<div id="container">


include 'template/header.php';

include 'template/panel.php';
<table id="threadlist" align="CENTER" border="0">
<tr><th id="tleft" width='30%' align='center'>Thread</th><th align='center' width='20%'>Replies</th><th id="tright" width='50%' align='right'>Last post&nbsp;</th></tr>


// We are selecting everything from the threads section in the database and ordering them newest to oldest.
$sql = mysql_query("SELECT * FROM threads ORDER BY posted DESC");

// Now we are getting our results and making them an array
while($r = mysql_fetch_array($sql)) {

// Everything within the two curly brackets can read from the database using $r[]
// We need to convert the UNIX Timestamp entered into the database for when a thread...
// ... is posted into a readable date, using date().
$posted = date("jS M Y h:i",$r[posted]);


// Now we will show the available threads
echo "<tr><td width='30%' align='center'><a href='msg.php?id=$r[id]'>$r[title]</a></td><td align='center' width='20%'>$r[replies]</td><td id='lastpost' width='50%' align='right'>by <a href=\"userinfo.php?user=$r[author]\">$r[author]</a> <br />on $posted</td></tr>";

// End of Array
Return current item: MegaBB