Gossamer Forum
Home : Products : DBMan : Installation :

range search - e.g. age

Quote Reply
range search - e.g. age
Sorry, I know this has been asked before, but I've tried all the solutions offered previously on the board, but none seem to work for me.

What I need to do is provide a way for people to do a search on an Age field (I'm running a penfriends type site). I've tried using Age-gt and Age-lt in fields, but I keep getting errors. If I just use the Age field, and type in, say, >20 <30, I get all ages from 20 upwards, past 30!

Can anyone provide a solution to this? The age field is called 'Age', if that helps at all Wink

Thanks,
Mark
Quote Reply
Re: range search - e.g. age In reply to
Hmmmmm.

I don't think I did any editing of the db file or the .cfg file to get it to work. But then it was a while back and I may have forgotten. Smile

You said earlier
Quote:
When I use the coding you supplied,
I get the $rec{'Age-gt'} etc in the text box, which - if I replace with the ages to search - doesn't of course work...

Do you mean that $rec{'Age-gt'} appears in the text box? I don't understand that. But I'm not sure that has anything to do with the range searches.

Since both the -gt and -lt searches work individually, there's obviously not a problem with your field definitions in the .cfg file or the form.

Did you do any editing of the db.pl file? The only other thing I can think of is that, if you did some editing, there may have been a } left out somewhere (or some other error) that would cause the script not to look at both the -gt and -lt fields.

If that's not the problem, I think this will have to be something for Alex to answer. I wish I had more expertise in Perl to help you.

One other thing that you didn't ask about Smile -- might I suggest that you change the Sex field to either radio buttons or a select field? When I did a search just for men on your db (using "m" as a search term), I got a number of women who had entered their sex as "Fema." (I'm assuming you have the field set to a limit of 4 characters). Alternatively, you could set the max length of that field to 1. Just a suggestion. Smile


------------------
JPD


[This message has been edited by JPDeni (edited December 14, 1998).]
Quote Reply
Re: range search - e.g. age In reply to
The following works for me:

<INPUT TYPE="TEXT" NAME="Age-gt" VALUE="$rec{'Age-gt'}" SIZE="4" MAXLENGTH="2">
<INPUT TYPE="TEXT" NAME="Age-lt" VALUE="$rec{'Age-lt'}" SIZE="4" MAXLENGTH="2">




------------------
JPD
Quote Reply
Re: range search - e.g. age In reply to
Thanks for your reply, JP, but it still doesn't work. When I use the coding you supplied, I get the $rec{'Age-gt'} etc in the text box, which - if I replace with the ages to search - doesn't of course work...

I have the Age field set to numer in the cfg file as well as the search page (I've tried it as both text and numer on the search page, with the same results - ie, if I do an age search from 13 to 15, for example, I'll get all ages from 13 up to whatever the oldest age is!).

Is there something I should be changing in the db file itself, or should everything work straight from the search page? I'm very desperate to get this working, as it's something I've been promising users for a few months now, and I'm beginning to lose patience with myself! Smile

Any help is greatly appreciated.

Thanks again, JP.

-Mark
Quote Reply
Re: range search - e.g. age In reply to
Could you give me the URL for your database?

There are only two things I can think of that might be a problem off the top of my head. First, do you have two separate fields -- one for "greater than" and one for "less than"? If so, the other possibility I can think of is that the "Match Any" search option is checked.

If you'd like to see my db in action, which uses this function, it's at http://www.drizzle.com/...lt&view_search=1.

(PS anybody know why the UBB hyperlinking code isn't working?)


------------------
JPD


[This message has been edited by JPDeni (edited December 14, 1998).]

[This message has been edited by JPDeni (edited December 14, 1998).]

[This message has been edited by JPDeni (edited December 14, 1998).]
Quote Reply
Re: range search - e.g. age In reply to
JP,

The URL for the page with the two GT and LT fields is at:

http://www.losfer.com/wwf/search_test.html

(I don't have it set on the public page, as yet).

Your site is actually one I've been to and seen the two fields being used. I'd like to be able to use the age fields on their own in a 'quick search' form on the first page, as well as on the page mentioned above, the quick search will only have the age fields, no other search options such as Match Any etc...

Did you have to edit your db file to get it to work? Because your's works just how I would like mine to...

Thanks for your help!

Mark
Quote Reply
Re: range search - e.g. age In reply to
Looks like you got it working? I tried it out and it searched properly..

Cheers,

Alex