Hi there
Help.. I cant seem to find an answer for this simple if () statement i think i need...!
while($row=mysql_fetch_array($result))
{
$result2 = MySQLQuery("SELECT id,sub_cat,name FROM links_cat WHERE sub_cat='$id' ORDER BY name ASC", $QueryError_Email,$QueryError_Browser);
if(mysql_num_rows($result2))
{
echo "<tr valign=top><td width='50%'>";
while($row2=mysql_fetch_array($result2))
{
$id2=$row2["id"];
$sub_cat2=$row2["sub_cat"];
$name2=$row2["name"];
$link_count = MySQLQuery("SELECT * FROM links WHERE cat_id='".$id2."' AND approved='yes' ORDER BY name ASC", $QueryError_Email,$QueryError_Browser);
$link_count=mysql_num_rows($link_count);
if($link_count==1){$link_text="link";}else{$link_text="links";}
echo "<a href=\"links.php?ax=list&sub=$id&cat_id=$id2\">$Title_Here</a><br>";
echo "<a href=\"links.php?ax=list&sub=$sub_cat2&cat_id=$id2\">$name2</a><br>";
}
echo "";
}
}//end while
The script above will echo a link $Title_Here and $name2 depending on how many times sub_cat=$id in the select statement.
But i only want the $Title_Here to echo once, but echo $name2 may be 5 or 6 times, depending on the select sub_cat=$id.
Colin