Forum Moderators: coopster
[pre]
| id | A | B | C | data |
| 1 | 1 | 2 | 1 | blah |
| 2 | 2 | 2 | 2 | blah |
| 3 | 1 | 1 | 2 | blah |
| 4 | 2 | 2 | 1 | blah |
.... and so on.
[/pre] $fa = ($FilterA != 'All') ? ' WHERE A = '.$FilterA : '';
$fb = ($FilterB != 'All') ? ((strlen($fa)) ? ' AND B = '.$FilterB : ' WHERE B = '.$FilterB) : '';
$fc = ($FilterC != 'All') ? ((strlen($fa) || strlen($fb)) ? ' AND C = '.$FilterC : ' WHERE C = '.$FilterC) : '';
$query = 'SELECT * FROM the_table'.$fa.$fb.$fc; //if all the $Filter's were 'All', $fa $fb & $fc will be blank strings, so should pull everything
$result = mysql_query($query);
//etc.. etc..