Perform appropriate queries by pressing links

Such a question as using $ quarry and if, as well as ELSE to achieve the following: In the Test.php page, we issue a query result

select * from table where sex = boy

But in the same file there is a reference to the result of the request

select * from table where sex = girl

And now the question is – how to make the result of the first and second query shown on the page of one file, that is, test.php; There are links 1 and 2, when you click 1, it takes the first request when you click 2, at the bottom performs the second request?


Answer 1, Authority 100%

<a href='test.php?sex=boy'>BOYS HERE</a>
<a href='test.php?sex=girl'>GIRLS HERE</a>
if(isset($_REQUEST['sex'])){
switch($_REQUEST['sex']){
 case 'boy': $sql = "select * from table where sex = boy"; break;
 case 'girl': $sql = "select * from table where sex = girl"; break;
 default: $sql = "select * from table where 1";
}
$res = mysql_query($sql);
// $res
}