"; // connect to database generalmapper or die if the connection is not successful @mysql_select_db("generalmapper",$dbcon) or die ("

Database Down. Please contact administrator - ".mysql_error().".




"); // The query for retreiving distinct genus from the database $genusquery="SELECT distinct genus FROM braconidae order by genus"; // Executing the query to get the genus names $genus = mysql_query($genusquery,$dbcon) or die(mysql_error()); // Count variable for the array of urls $ct=0; // The array for holding the hyperlinks generates dynamically $urls=array(); // L:ooping through the genus names fetched while($genusval = mysql_fetch_assoc($genus)) { // Generating url only with genus names $urls[$ct]=$mainstr."&genus=".$genusval['genus']."\">".$genusval['genus'].$endstr; // Incrementing the counter $ct++; // Generate queries for distinct species $speciesquery="SELECT distinct species FROM braconidae WHERE genus like '".$genusval['genus']."' order by species"; // Fetching the distinct species for each genus $species=mysql_query($speciesquery,$dbcon); while($speciesval=mysql_fetch_assoc($species)){ // Generating the hyperlink with genus names and species name $urls[$ct]=$mainstr."&genus=".$genusval['genus']. "&species=".$speciesval['species']."\">".$genusval['genus']. " ".$speciesval['species'].$endstr; // Incrementing the counter $ct++; } } // Closing the connection with database @mysql_close($dbcon); $smarty = new Smarty; $smarty->assign("urls",$urls); $smarty->assign("header","Projects"); $smarty->display("sharkeyProjects.tpl"); ?>