Jump to content

[SOLVED] Creating a PHP generated list of links to unique pages


neogemima

Recommended Posts

Hello, so here is my dilemma.  I have managed, thanks to your help here on the forums to create a page that accepts input from users to create "News" postings to my website and get that news to display in order on the home page using a generic php file I named "recentnews.php".

 

Now I would like to get each posting to link to its unique content, i.e. a page displaying the title and contents of that particular post.

 

Right now, to get recentnews.php to post the articles I am using this for loop:

 

$i = $num_rows;

 

for($i = $num_rows; $i >= ($num_rows - 31); $i--) {

$sql = "SELECT id, date, title FROM Newsposting WHERE id = $i";

$queryresult = mysqli_query($db, $sql);

$rowresult = mysqli_fetch_array($queryresult, MYSQLI_ASSOC);

 

//printf ("<u>(%s) %s</u>\n", $rowresult["date"], $rowresult["title"]);

 

echo '<a href="article.php">'.$rowresult['date'].'     '.$rowresult['title'].'</a>';

echo "<br>";

}

 

I want only the most recent 31 posts to display.  I know that "<a href="article.php">" is not correct.  Anyone have any suggestions?

 

The site is: www.biotechposting.com and these news posts can be seen on the home page, right now they are just tests with random titles.  Thanks in advance.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.