Gossamer Forum
Home : Products : DBMan : Customization :

Age search...HELP!!!

Quote Reply
Age search...HELP!!!
Hello,

I'm trying to get the age search MOD working with no luck so far.

This is the code I'm using:
In the db.cgi sub_query:

if ($in{'Age-gt'}) {
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime(time());
my $byear = $year - $in{'Age-gt'} + 1900;
++$day;
++$mon;
($day < 10) and ($day = "0$day");
($mon < 10) and ($mon = "0$mon");
$date = $byear . $mon . $day;
$in{'Birthdate-lt'} = &get_computed_date($date);
}
if ($in{'Age-lt'}) {
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime(time());
my $byear = $year - $in{'Age-lt'} + 1899;
++$mon;
($day < 10) and ($day = "0$day");
($mon < 10) and ($mon = "0$mon");
$date = $byear . $mon . $day;
$in{'Birthdate-gt'} = &get_computed_date($date);
}

----------------------------------
And in the html.pl html_search_form:

<TR><TD ALIGN="Right" VALIGN="TOP"> <$font_color>Age: </FONT></TD>
<TD VALIGN="TOP">
<$font_color>between <INPUT TYPE="TEXT" NAME="Age-gt" VALUE="$rec{'Age-gt'}" SIZE="2" MAXLENGTH="2">
and <INPUT TYPE="TEXT" NAME="Age-lt" VALUE="$rec{'Age-lt'}" SIZE="2" MAXLENGTH="2">
</TD></TR>

That's all I could find searching through other posts.
The $Age field is calculated by the database (the user has to enter his birth date (Birthdate field) and then the $Age is calculated using the UNIX date).

The $Age works fine and I was able to print the age of the user when I view a profile but I can't make the Age Search work.

What do I do wrong?