We have a forum (Php) for our client's school cadets and want to know how to make available in search
cadets in age and gender range.
There is no feild of age in our forum Mysql database. but it out puts age of cadet through a code
which calculates cadet's age from db feilds cadet_birthday,
cadet_birthmonth and cadet_birthyear
and in profile it says
age : 15
gendre : male
you have to make a mysql search code for searching cadets for a particular range like e.g.
gender = male/female
age= 10 to 15
and code to safe guard serch and input feilds
form SQL injections.
php code :
$max_results = 10;
$from = (($page * $max_results) - $max_results);
$get_results = mysql_query("SELECT * FROM cadetforum_users WHERE cadet_gender='".$_GET['gender']."' AND cadet_class='".$_GET['class']."' AND cadet_rank='".$_GET['rank']."' AND cadet_section='".$_GET['section']."' AND active_status='".$_GET['online']."' AND cadet_picture='".$_GET['picture']."' LIMIT $from, $max_results");