The following is my search query. It works just fine and I have no problems with it.
Code: Select all
mysql_select_db($database_connFauna, $connFauna);
$query_rsspecies = sprintf("SELECT * FROM fauna WHERE phylum LIKE '%%%s%%' AND clase LIKE '%%%s%%' AND orden LIKE '%%%s%%' AND familia LIKE '%%%s%%' AND genero LIKE '%%%s%%'AND especie LIKE '%%%s%%' AND ('%s'!='' OR '%s'!='' OR '%s'!='' OR '%s'!='' OR '%s'!='' OR '%s'!='') ORDER BY phylum, clase, orden, familia, genero, especie ASC", $varphylum_rsspecies,$varclase_rsspecies,$varord_rsspecies,$varfam_rsspecies, $vargen_rsspecies, $vartax_rsspecies,$varclase_rsspecies,$varphylum_rsspecies,$varord_rsspecies,$varfam_rsspecies, $vargen_rsspecies,$vartax_rsspecies);
$rsspecies = mysql_query($query_rsspecies, $connFauna) or die(mysql_error());
$totalRows_rsspecies = mysql_num_rows($rsspecies);Of course when I do this query I get all the genera in the database:
Code: Select all
mysql_select_db($database_connFauna, $connFauna);
$query_rsgenero = "SELECT DISTINCT genero FROM fauna";
$rsgenero = mysql_query($query_rsgenero, $connFauna) or die(mysql_error());
$row_rsgenero = mysql_fetch_assoc($rsgenero);
$totalRows_rsgenero = mysql_num_rows($rsgenero);How can I combine or reference the two so that I am only getting the genera that result from the original search. Any suggestions would be much appreciated.
Jarow