Help - Search - Members - Calendar
Full Version: [Resolved] Single entry page
Codegrrl.com Forums > Script Help > Tutorial Help
The Second Libra
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
}

?>
Amelie
1) Yes, you do need the single entry page. This is the page that controls comments, passwords, etc. Strictly speaking, it could be all in one page, but that would require more complicated code.

2) See this FAQ.
The Second Libra
Thank you much Amelie. :-D I think I actually got the page too work for me.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.