Try this code. It's simple but works very well. I put in the query select statement and the table set up to show you how it all works together. You'll have to make a few appropriate changes but that I'm sure you can figure out. This is what I use and it works fine. Enjoy!
<?
mysql_pconnect ("mysql.mysite.com", "user", "paswword")
or die ("Could not connect to database");
mysql_select_db("database") or
die ("Could not select database");
$result=mysql_query("select * from table where sex ='$sex'
and state = '$state' and religion = '$religion'");
$num_rows=mysql_num_rows($result);
print "There are currently $num_rows members that match what you are looking for!</font><p>";
function row_color($cnt, $even, $odd){
print ($cnt%
2) ? "<tr bgcolor=\"$odd\">" : "<tr bgcolor=\"$even\">";
}
print "<table border=\"0\" cellspacing=\"1\" cellpadding=\"6\"><tr>";
print "<th BGCOLOR=#996633><font color=#FFFFFF><b>SEX</b></font></th><th BGCOLOR=#996633><font color=#FFFFFF><b>STATE</b></font></th><th BGCOLOR=#996633><font color=#FFFFFF><b>RELIGION</b></font></th><th BGCOLOR=#996633><font color=#FFFFFF><b>ETHNICITY</b></font></th>
<th BGCOLOR=#996633><font color=#FFFFFF><b>AGE</b></font></th>";
for ($x= 0; $x <mysql_num_rows($result); $x++)$cnt=0;
while($a_row=mysql_fetch_array($result))
{
this is where you put in the colors you want
row_color( $cnt++, "#FFFFFF", "#000000");
print "<td>".$a_row['sex']."</td><td>".$a_row['state'].
"</td><td>".$a_row['religion']."</td><td>".$a_row['ethnicity'].
"</td><td>".$a_row['age']."</td></tr>\n";
}
print"</table>\n";
?>