spoco Posted May 5, 2009 Share Posted May 5, 2009 Hello. I have created a PHP page with several recordsets that are querying a table and working fine overall. I would like to set up a way on this page to run the same query, but allow the user to select a school (a field in the table) and filter the same results by school. Here is an example of two recordsets (There are 21 in total) mysql_select_db($database_Survey, $Survey); $query_drops = "SELECT SUM(survey.drops) FROM survey "; $drops = mysql_query($query_drops, $Survey) or die(mysql_error()); $row_drops = mysql_fetch_assoc($drops); $totalRows_drops = mysql_num_rows($drops); mysql_select_db($database_Survey, $Survey); $query_Recordset2 = "SELECT SUM(survey.poweroutlets) FROM survey "; $Recordset2 = mysql_query($query_Recordset2, $Survey) or die(mysql_error()); $row_Recordset2 = mysql_fetch_assoc($Recordset2); $totalRows_Recordset2 = mysql_num_rows($Recordset2); What I would like to do is create a drop down menu with a list of schools in which the user can select and the same results would be displayed, only displayed by school. Quote Link to comment https://forums.phpfreaks.com/topic/156937-filtering-with-an-if-statement/ Share on other sites More sharing options...
Maq Posted May 5, 2009 Share Posted May 5, 2009 What part are you having trouble with? Quote Link to comment https://forums.phpfreaks.com/topic/156937-filtering-with-an-if-statement/#findComment-826717 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.