Help - Search - Members - Calendar
Full Version: [resolved] Archives - help
Codegrrl.com Forums > Script Help > Tutorial Help
Nessa
Hiya!!

I had a question about the archiving. My blog is set up so the index.php will show only five entries. But when I click on the link to view my different entries it only shows me the ones the index page.

My code for my archive page:
QUOTE


<?php


mysql_connect("localhost", "crazy-cutie_com", "*******");
mysql_select_db("crazy-cutie_com_1");


$result = mysql_query("SELECT timestamp, id, title FROM php_blog WHERE FROM_UNIXTIME(

timestamp, '%Y' ) = $year ORDER BY id DESC");

while ($row = mysql_fetch_array($result))
{
$date = date("l F d Y",$row["timestamp"]);
$id = $row["id"];
$title = $row["title"];

echo "$date<br><a href=\"http://www.crazy-cutie.com/index.php?id=$id\">$title</a><br><br>";
}

?>


What am I doing wrong??? =/
Amanda
This might sound like a silly question, but did you add more than 5 entries to your database?
Nessa
no not yet, but I've had this problem on my old domain as well. (just kept ingnoring that problem and concentrated on other parts of my site) And there I blogged dozens of times. I know, only got 3 entries, but when clicking on the title in the archives page it's only supposed to show that particulair entry???? Or am I being silly (again tongue.gif )

THX biggrin.gif
Amanda
Oh, I understand now. I thought you meant it wasn't showing the "correct number of entries"

The links in your archives page should be pointed to the INDIVIDUAL entry page, not the index page. No matter how you link to index.php, whether it be index.php, index.php?id=x, you'll always see the latest entries instead of the individual entry.

Is it possible that you tried to combine the two codes, or maybe you didn't make one at all? Maybe it's a simple as not linking to the correct page.
Nessa
Erm.........I think I understand what you mean. Only I'm not sure where the link should be pointed to instead.

All my entries are located at my index page. I'm not sure what my individual entry page is unsure.gif . shouldn't that be index.php?id=$id ?????

Sorry for being such a dumb*ss
Amanda
Your individual entries page should look something like this:

entry.php
CODE
<?php

mysql_connect ('localhost', '$db_username', '$db_password');
mysql_select_db ('$db_name');

$sql = "SELECT * FROM php_blog WHERE id=$id";

$result = mysql_query($sql) or
print ("Can't select entries from table php_blog.<br />" . $sql . "<br />" . mysql_error());

while ($row = mysql_fetch_array($result))
    {
 $date = date("l F d Y",$row["timestamp"]);
 $title = $row["title"];
 $entry = $row["entry"];

 print "<b>$title</b><br><br>";
 print "$entry<br><br>";
 print "posted on $date<br><br>";
    }

?>
Nessa
It's working!!! biggrin.gif biggrin.gif

It turned out I had no single page entry at all, that's why it wasnt working. Dumb me, teehee LOL!!

Thx so much!! wub.gif
Sairah
I'm having the same problem and I just created an individual entries page BUT...I don't know where I put the code for the archives to link there in? There's no link in the archives page code, so...I'm kind of lost. I've looked through the tutorial numerous times but can't seem to find my answer. ='(
Sairah
nvm, I figured out how to call up the proper page and stuff...thanks for all the guidance, I think I was just a tad stupid. =P
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.