I'm attempting to search the filtered results again finding distinct record from records matching the category passed to the page from the fist results that are list by distinct category.
What am i missing?
+++++++++++++++++++++++++++++++++++
<?php
include ("connect.inc");
if ($category)
{$result = mysql_query("SELECT DISTINCT sub_cat FROM catalog WHERE category=$category",$db);
if ($myrow = mysql_fetch_array($result))
{do
{printf("<a href=\"%s?sub_cat=%s\">%s </a><br>\n", $PHP_SELF, $myrow["sub_cat"], $myrow["sub_cat"]);}
while ($myrow = mysql_fetch_array($result));
}
else
{echo "Sorry, no records were found!";}
}
else
{$result = mysql_query("SELECT DISTINCT category FROM catalog" ,$db);
if ($myrow = mysql_fetch_array($result))
{do
{printf("<a href=\"%s?category=%s\">%s </a><br>\n", $PHP_SELF, $myrow["category"], $myrow["category"]);}
while ($myrow = mysql_fetch_array($result));
}
else
{echo "Sorry, no records were found!";}
}
?>
+++++++++++++++++++++++++++++++++++
The code pulls the categories ok but when I click the category to move to view the sub categories i get the following error.
Supplied argument is not a valid MySQL result resource in /home/view_cat.php on line 17
Sorry, no records were found!
I get the following error after
Gib