I'm new at php, so bear with me.
I'm having some difficulties with the single entry page in the build a blog tutorial, and I have a few questions about it.
1.) Do I need the single entry page? I want to add passworded entries, comments . . .etc, and I was wondering if the page is necessary for those functions.
2.) Secondly, I'm working with the basic coding for the single entry page, and every time I run the script it gives me a message that says "Invalid ID specified." Now, this is probably some sort of mistake that is an easy fix, but I'm not nearly familiar enough with the php language to try and fix it myself without worry of completely destroying it.
Here is my 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 php_blog WHERE id='$id' LIMIT 1";
$result = mysql_query($sql) or print ("Can't select entry from table php_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']);
?>
<p><strong><?php echo $title; ?></strong><br /><br />
<?php echo $entry; ?><br /><br />
Posted on <?php echo $date; ?>
</p>
<?php
}
?>