I think I understand what you're trying to do.
If the user goes to:
http://www.domain.com/archive.php
then it'll give them a list of archive topics. These archive topics will have links such as:
http://www.domain.com/archive.php?lang=5
where the 5 would be the article number. When they click on that you want it to display the article. The code you posted would be fine for when they want the list. But now you need code for displaying the actual article. So here's what you do:
<?php
/ first check to see if we need to display the article list or an article. To do this we check to see if $lang is created. /
if(!isset($lang)) { // Begin article list
/ $lang is not set so display list of articles /
/Gets the stuff from the archive.
In this case, the php archive./
$db = "acidsun";
$link = mysql_connect("localhost");
if(!$link)
die("Couldn't connect to MySQL");
mysql_select_db($db, $link)
or die("Couldn't open the List:" .mysql_error());
/ Here we grab all the article names and such to make links to them /
$result = mysql_query("SELECT * FROM archive_cats ORDER BY cat_name");
/End of access to opening MySQL.
Now we want to print out the tables
to show the archive content./
while ($list = mysql_fetch_array($result))
{
print "<a href=\"archive.php?$lang\">$list[cat_name]</a><br>";
}
} // End article list
else { // Begin article
/ or if $lang is set then we want to display the article, so we connect to the database and get the article info and display it /
$db = "acidsun";
$link = mysql_connect("localhost");
if(!$link)
die("Couldn't connect to MySQL");
mysql_select_db($db, $link)
or die("Couldn't open the List:" .mysql_error());
/ Here we grab only the line of data from the selected article /
$result = mysql_query("SELECT * FROM archive_cats WHERE id=$lang");
/End of access to opening MySQL.
Now we want to print out the tables
to show the archive content./
$list = mysql_fetch_array($result) {
/ Now you have all the information for only the selected article in $list. You can grab whatever fields you need and display them here. /
}
} // End article
?>