Here's my simple blog, i'm still a little new to PHP. I didn't use any tutorials on this just a little help at php.net. There's probably a lot of things wrong, but I would like to learn. Thank you.
blog.php
<html>
<head>
<title>Chad's Blog</title>
<meta http-equiv="Content-Type"
content="text/html; charset=us-ascii">
<style type="text/css">
<!--
body {
background-color: #84857A;
}
-->
</style>
</head>
<body>
<table width="412"
height="342"
border="0"
align="center"
cellpadding="0"
cellspacing="0">
<tr bgcolor="#DFDFDF">
<td width="412"
height="51"
valign="top">
<div align="center">
<p><a href="blog.php"><img src="logo.gif"
width="294"
height="51"
border="0"></a></p>
</div>
</td>
</tr>
<tr bgcolor="#DFDFDF">
<td height="28"
valign="top">
<form action="search.php"
method="get"
name="search_form"
id="search_form">
Home | <a href="archive.php">Archives</a> |
Search: <input name="search"
type="text"
id="search"> <input type="submit"
name="Submit"
value="search">
</form>
</td>
</tr>
<tr bgcolor="#DFDFDF">
<td height="197"
valign="top">
<?php
include 'admin/db.php';
if (!isset($_GET['p'])) {
$limit=0;
}else {
$limit=$_GET['p'];
}
$endpoint=($limit+4);
$result = mysql_query( "SELECT id,date,title,entry FROM data order BY id DESC limit $limit, $endpoint " )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
$i=0;
while ($i < $num_rows )
{
$id=mysql_result($result,$i,'id');
$date=mysql_result($result,$i,'date');
$title=mysql_result($result,$i,'title');
$entry=mysql_result($result,$i,'entry');
?>
<table width="339"
height="134"
border="0"
align="center"
cellpadding="0"
cellspacing="0">
<tr>
<td width="333"
height="25"
bgcolor="#ACBE17">
<form name="form2"
method="get"
action="comments.php">
<? echo $date; ?>
| <? echo $title; ?>
| <input type="hidden"
name="idnum"
value="<?php echo $id; ?>">
<a href=
"http://cdc.servebeer.com/blog/comments.php?idnum=<?php echo $id;?>">
<?php
$comments=mysql_query("SELECT commentid FROM comments WHERE commentid = '$id'") or die("comment died");
$comment_num_rows=mysql_num_rows($comments);
$commentnumbers=0;
if ($comment_num_rows == 0 ) {
echo "No ";
} else {
echo $comment_num_rows ." ";
}
?>Comments</a>
</form>
</td>
</tr>
<tr>
<td height="110"
valign="top"><? echo $entry; ?>
</td>
</tr>
</table><?
$i++;
}
?>
<div align="center">
<?php
if ($num_rows >= $limit) {
$limit=$limit + 4;
echo "<a href='blog.php?p=$limit'>Next</a>";
echo " ". "|" . " ";
}
?><a href=
"blog.php">Home</a>
</div>
</td>
</tr>
<tr bgcolor="#DFDFDF">
<td height="20"
valign="top">
<div align="center"></div>
</td>
</tr>
</table>
</body>
</html>