In next example we will extend the query to more complex and specific query.
This query will return you all male personal, ordered by age and will start from old to young mans.
<?php
$query="select `id`, `name` from `staff` where `sex`='male' order by `age` desc";
$result=mysql_query($query);
?>
And the above example will return you:
| ID |
Name |
Sex |
Age |
| 4 |
Peter Trump |
Male |
46 |
| 1 |
John Smith |
Male |
33 |