Well, firstly....
Read php manual on various database functions. You didn't specify what database you are using... I'll assume you are using MySQL...
This is the code
<?
if($enter)
{
$tablename="your table in the database";
//connecting to database
$conn=mysql_connect(host, user, password);
//selecting database
$db=mysql_select_db("databasename", $conn);
//actual query
$sql="select age from $tablename where age<$age";
$result=mysql_query($sql, $conn);
if($result)
{
echo "<script>window.alert(\"Query executed\")</script>";
}
}
$html_block="
<body>
<form method=post action=$PHP_SELF>
<input type=text name=age>
<br>
<br>
<input type=submit name=enter value=Search>
</form>
</body>
";
echo "$html_block";
?>
Code of course can be modified in your $sql variable you can change sign from < to > or to =< or whatever you want. Your form variable you can adjust as well to reflect what kind of query you are doing...
Good luck,
Di