entry.php
CODE
<?php
mysql_connect ('****', '****', '****');
mysql_select_db ('****');
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
die("Invalid ID specified.");
}
$id = (int)$_GET['id'];
$sql = "SELECT * FROM blog WHERE id='$id' LIMIT 1";
$result = mysql_query($sql) or print ("Can't select entry from table blog.<br />" . $sql . "<br />" . mysql_error());
while($row = mysql_fetch_array($result)) {
$date = date("l F d Y", $row['timestamp']);
$title = stripslashes($row['title']);
$entry = stripslashes($row['entry']);
$listening = stripslashes($row['listening']);
$reading = stripslashes($row['reading']);
$quote = stripslashes($row['quote']);
?>
<table width="370" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="entryheader"><?php echo $title; ?></td>
</tr>
<tr>
<td class="entrysub"><?php echo $date; ?></td>
</tr>
<tr>
<td class="entrysub"><strong>Currently Reading:</strong> <?php echo $reading; ?></td>
</tr>
<tr>
<td class="entrysub"><strong>Currently Listening To:</strong> <?php echo $listening; ?></td>
</tr>
<tr>
<td class="entrysub"><strong>Quote:</strong> <?php echo $quote; ?></td>
</tr>
<tr>
<td class="entry"><br><?php echo $entry; ?></td>
</tr>
</table>
<br><br><br>
<?php
}
$commenttimestamp = strtotime("now");
$sql = "SELECT * FROM blog_comments WHERE comentry='$id' ORDER BY timestamp";
$result = mysql_query ($sql) or print ("Can't select comments from table blog_comments.<br />" . $sql . "<br />" . mysql_error());
( I WANT THIS PART IN THE TABLE )
while($row = mysql_fetch_array($result)) {
$timestamp = date("l F d Y", $row['timestamp']);
printf("<hr />");
print("<p>" . stripslashes($row['comment']) . "</p>");
printf("<p>Comment by <a href=\"%s\">%s</a> @ %s</p>", stripslashes($row['url']), stripslashes($row['name']), $timestamp);
printf("<hr />");
}
?>
<form method="post" action="process.php">
<p><input type="hidden" name="comentry" id="comentry" value="<?php echo $id; ?>" />
<input type="hidden" name="timestamp" id="timestamp" value="<?php echo $commenttimestamp; ?>">
<strong><label for="name">Name:</label></strong> <input type="text" name="name" id="name" size="25" /><br />
<strong><label for="email">E-mail:</label></strong> <input type="text" name="email" id="email" size="25" /><br />
<strong><label for="url">URL:</label></strong> <input type="text" name="url" id="url" size="25" value="http://" /><br />
<strong><label for="comment">Comment:</label></strong><br />
<textarea cols="25" rows="5" name="comment" id="comment"></textarea></p>
<p><input type="submit" name="submit_comment" id="submit_comment" value="Add Comment" /></p>
</form>
mysql_connect ('****', '****', '****');
mysql_select_db ('****');
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
die("Invalid ID specified.");
}
$id = (int)$_GET['id'];
$sql = "SELECT * FROM blog WHERE id='$id' LIMIT 1";
$result = mysql_query($sql) or print ("Can't select entry from table blog.<br />" . $sql . "<br />" . mysql_error());
while($row = mysql_fetch_array($result)) {
$date = date("l F d Y", $row['timestamp']);
$title = stripslashes($row['title']);
$entry = stripslashes($row['entry']);
$listening = stripslashes($row['listening']);
$reading = stripslashes($row['reading']);
$quote = stripslashes($row['quote']);
?>
<table width="370" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="entryheader"><?php echo $title; ?></td>
</tr>
<tr>
<td class="entrysub"><?php echo $date; ?></td>
</tr>
<tr>
<td class="entrysub"><strong>Currently Reading:</strong> <?php echo $reading; ?></td>
</tr>
<tr>
<td class="entrysub"><strong>Currently Listening To:</strong> <?php echo $listening; ?></td>
</tr>
<tr>
<td class="entrysub"><strong>Quote:</strong> <?php echo $quote; ?></td>
</tr>
<tr>
<td class="entry"><br><?php echo $entry; ?></td>
</tr>
</table>
<br><br><br>
<?php
}
$commenttimestamp = strtotime("now");
$sql = "SELECT * FROM blog_comments WHERE comentry='$id' ORDER BY timestamp";
$result = mysql_query ($sql) or print ("Can't select comments from table blog_comments.<br />" . $sql . "<br />" . mysql_error());
( I WANT THIS PART IN THE TABLE )
while($row = mysql_fetch_array($result)) {
$timestamp = date("l F d Y", $row['timestamp']);
printf("<hr />");
print("<p>" . stripslashes($row['comment']) . "</p>");
printf("<p>Comment by <a href=\"%s\">%s</a> @ %s</p>", stripslashes($row['url']), stripslashes($row['name']), $timestamp);
printf("<hr />");
}
?>
<form method="post" action="process.php">
<p><input type="hidden" name="comentry" id="comentry" value="<?php echo $id; ?>" />
<input type="hidden" name="timestamp" id="timestamp" value="<?php echo $commenttimestamp; ?>">
<strong><label for="name">Name:</label></strong> <input type="text" name="name" id="name" size="25" /><br />
<strong><label for="email">E-mail:</label></strong> <input type="text" name="email" id="email" size="25" /><br />
<strong><label for="url">URL:</label></strong> <input type="text" name="url" id="url" size="25" value="http://" /><br />
<strong><label for="comment">Comment:</label></strong><br />
<textarea cols="25" rows="5" name="comment" id="comment"></textarea></p>
<p><input type="submit" name="submit_comment" id="submit_comment" value="Add Comment" /></p>
</form>
I want it to go into a table like this if possible.
CODE
<table width="370" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="56">icon</td>
<td width="306" rowspan="4">comment</td>
</tr>
<tr>
<td>name</td>
</tr>
<tr>
<td>date</td>
</tr>
<tr>
<td>www</td>
</tr>
</table>
<tr>
<td width="56">icon</td>
<td width="306" rowspan="4">comment</td>
</tr>
<tr>
<td>name</td>
</tr>
<tr>
<td>date</td>
</tr>
<tr>
<td>www</td>
</tr>
</table>
Second I was wondering if there was a way to customize the comments so that if I post a comment it looks different than normal comments?
Any help would be greatly appreciated. Please and Thank You very much!