Hiya,
Can anyone tell me if there is anything wrong with this piece of code? It's suppose to display the cat_id name but always displays cat_id #1 name on every page, no matter what category you are viewing.
<?php
ob_start();
include('config.php');
include('banner_lib.php');
include('header.php');
$ax=$_GET["ax"];
$list_type=$_GET["l"];
////////////////
// List Function
////////////////
if ($ax=="list")
{
if($list_type=="clicks")
{
echo "<p class=\"bodylgbold\">$popular Most Popular Links</p>";
echo "<p class=\"bodysm\"> > <a href=\"$PHP_SELF\">Home</a> > Popular Links</p>";
$sql_rqst="SELECT * FROM links WHERE approved='yes' ORDER BY clicks DESC LIMIT 0,".$popular;
}
else if($list_type=="date_added")
{
echo "<p class=\"bodylgbold\">$new Newest Links</p>";
echo "<p class=\"bodysm\"> > <a href=\"$PHP_SELF\">Home</a> > Newest Links</p>";
$sql_rqst="SELECT * FROM links WHERE approved='yes' ORDER BY date_added,id ASC LIMIT 0,".$new;
}
else
{
$topic_result = MySQLQuery("SELECT * FROM links_cat WHERE id=$cat_id", $QueryError_Email,$QueryError_Browser);
while($topic_row = mysql_fetch_array($topic_result))
{
$id=$topic_row["id"];
$formcat_id=$topic_row["id"];
$sub_cat=$topic_row["sub_cat"];
$name=$topic_row["name"];
$dsc=$topic_row["dsc"];
}
if($sub_cat != 0)
{
$topic2_result = MySQLQuery("SELECT id,sub_cat,name FROM links_cat WHERE id=$sub_cat", $QueryError_Email,$QueryError_Browser);
while($topic2_row = mysql_fetch_array($topic2_result))
{
$id2=$topic2_row["id"];
$sub_cat2=$topic2_row["sub_cat"];
$name2=$topic2_row["name"];
}
$trail="<a href=\"$PHP_SELF?ax=list&sub=$id2&cat_id=$id2\">$name2</a> > $name";
}
else
{
$trail=$name;
}
echo "<p class=\"bodylgbold\">$name</p>";
echo "<p class=\"bodysm\"> > <a href=\"$PHP_SELF\">Home</a> > $trail</p>";
echo "<p class=\"bodymd\">$dsc</p>";
Thanks!