Ok I got the idea now, but I am having trouble with starting out some code. I am using MySQL and here is what I have for code right now (its really messy i think):
<?php
$user="user";
$pass="password";
$db="database";
$link=mysql_connect("localhost",$user,$pass);
if(!$link)
die("Couldn't connect to MySQL.");
mysql_select_db($db,$link)
or die("Couldn't open $db: ".mysql_error());
if(isset($id) && !empty($id))
{
$result=mysql_query("SELECT * FROM tutorials WHERE id=$id");
$result2=mysql_query("SELECT * FROM tute_comments WHERE tute_id=$id");
$num_comnts=mysql_num_rows($result2);
while($a_row=mysql_fetch_array($result))
{
$newview=$a_row[views]+1;
$query="UPDATE tutorials SET views='$newview' where id=$id";
mysql_query($query);
print"<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td><b>$a_row[title]</b></td>
</tr>
<tr>
<td>
<p>$a_row[body]</p>//Prints body of the tutorial
</td>
</tr>
<tr>
<td><font color=\"#999999\" size=\"2\">Posted by <a href=\"mailto:$a_row[auth_email]\">$a_row[auth_name]</a>
on $a_row[date] with $a_row[views] views and <a href=\"http://acidsun.com/read_comnt.php?id=$a_row[id]\"><u>$num_comnts comments</u></a> [<a href=\"http://acidsun.com/post_comnt.php?id=$a_row[id]\"><u>post comment</u></a>]</font></td>
</tr>
<tr>
<td> </td>
</tr>
</table>";
}
}
else
{
$result=mysql_query("SELECT * FROM tutorials ORDER BY id DESC");
while($a_row=mysql_fetch_array($result))
{
$result2=mysql_query("SELECT * FROM tute_comments WHERE tute_id=$a_row[id]");
$num_comnts2=mysql_num_rows($result2);
print"<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td><b><a href=\"http://acidsun.com/$page?id=$a_row[id]\"><u>$a_row[title]</u></a></b></td>
</tr>
<tr>
<td>
<p>$a_row[description]</p>
</td>
</tr>
<tr>
<td><font color=\"#999999\" size=\"2\">Posted by <a href=\"mailto:$a_row[auth_email]\">$a_row[auth_name]</a>
on $a_row[date] with $a_row[views] views and <a href=\"http://acidsun.com/read_comnt.php?id=$a_row[id]\"><u>$num_comnts2 comments</u></a> [<a href=\"http://acidsun.com/post_comnt.php?id=$a_row[id]\"><u>post comment</u></a>]</font></td>
</tr>
<tr>
<td> </td>
</tr>
</table>";
}
}
mysql_close($link);
?>