You folks can laugh if you want to, but I cannot get this code to work correctly....
It is supposed to list all the categories from the article_categories table. Each category will be displayed as a LINK. This link contains the parameter so that articles that are matched to the category will be displayed. Simple right?
Well here is the problem- when I test the page, it displays the category, but the link points to the wrong page- it is pointing to the FIRST link that is listed on the page- www.mysite.com/ARTICLES/article_full_listing.php instead of www.mysite.com/ARTICELS/article_category_listing.php?id=1
I know this is weird, and probably simple to figure out, but it is really annoying me now. Can someone help me out?
<?php
INCLUDE("../INCLUDES/afile.php");
INCLUDE("../header.php");
//Open the database connection and select the database
$link = mysql_connect($host, $user, $pass) or die("The Database is temporarily UNAVAILABLE. Please try again later.");
mysql_select_db($db1, $link) or die("The Database is temporarily UNAVAILABLE. Please Try Again Later.");
//Set up the Page
PRINT("
<br>
<center>
<span class= 'article_title'>
ASTRONOMY ARTICLES<br>
CATEGORY INDEX<br>
</span>
<br>
<a href='http://www.mysite.com/ARTICLES/article_full_listing.php'>click here for full index</href>
<br><br>
</center>
<table>
");
//Get the Category Listings
$query =
"SELECT
category_id,
category_name
FROM
article_categories
";
$result = mysql_query($query, $link);
WHILE($array = mysql_fetch_array($result))
{
PRINT("
<tr>
<td>
<a href='http://www.mysite.com/ARTICLES/article_category_listing.php?id=$array[0]'>$array[1]</href>
</td>
</tr>
");
}
//Finish up the page
PRINT
("
</tr>
</table>
");
INCLUDE("../footer.php");