Jump to content

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


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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.