Gossamer Forum
Home : Products : Gossamer Links : Discussions :

More than, less than search Function

Quote Reply
More than, less than search Function
I was wondering if anyone would be able to help me out with search function feature in GLinks. Here is the issue: For the search function, there are about 30 different fields. For the price/cost search (select, drop down menu), options are as below

Less than US$ 5.00
US$ 5.00 to US$ 25.00
US$ 20.00 to US$ 100.00
More than US$ 100.00
All

In Link Properties, the field name is Cost & end users are required to do only text inputs. So for all links, it is anywhere from 2.99 to about 1000.00

Any help in making this work, would be very much appreciated.

Thank you.

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] More than, less than search Function In reply to
Hi,

Using lt or gt should work.

Example, you have a field called "Price". You could do this;

search.cgi?OTHER_OPTIONS;Price-gt=500;Price-lt=1000

This would search for anything that has a value of "Price", > 500 and < 1000 (NB, this will match stuff like 999, just in case you wonder why it doesn't match stuff at the higher or lower end of the scale).

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] More than, less than search Function In reply to
Hi Andy,

Thanks for the helpful reply.

It seems like for some reason only part of it wants to work. (I just inserted the value in the URL instead of testing via search form)

In below, (a) works, while (b) does not.

(a) search.cgi?OTHER_OPTIONS;Cost-gt=0;Cost-lt=5
(b) search.cgi?OTHER_OPTIONS;Cost-gt=5;Cost-lt=10

While there are 2 listings, one with cost US$ 4.25, other at US$ 7.00.

Also, I just added another link with cost at US$ 12.50. & tried different -gt & -lt values, and it is making even a bigger mess.

For search.cgi?Cost-gt=1;Cost-lt=5 it shows the links with US$ 4.25 & US$ 12.50

For search.cgi?Cost-gt=5;Cost-lt=10 it don't show anything.

For search.cgi?Cost-gt=5;Cost-lt=15 it don't show anything.

For search.cgi?Cost-gt=2;Cost-lt=9 it shows US$ 4.25 & US$ 7.00

Any ideas?

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] More than, less than search Function In reply to
~ any thoughts ? ~

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] More than, less than search Function In reply to
Hi,

Are these TEXT/CHAR fields? If so, thats your problem =)

I believe lt and gt only works on INT (or FLOAT) fields.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] More than, less than search Function In reply to
In Reply To:
Hi,

Are these TEXT/CHAR fields? If so, thats your problem =)

I believe lt and gt only works on INT (or FLOAT) fields.

Cheers

Hi Andy,

Thank you for the reply.

Yeah, it is a CHAR field.

Would it be okay if I were to change it to INT right now? or would it corrupt the DB?

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] More than, less than search Function In reply to
Hi,

Ah, thats most likely your problem. Personally, I'd be very careful when changing it.

1) Backup your WHOLE database (can never be too careful)
2) Then go in via Database > Links > Properties > click field to edit, and change the "field type" to INT.
3) You will more than likely then need to go into MySQLMan, and change the field type to FLOAT. If you leave it to just INT, then it will more than likely cut off the decimal places (i.e 2.43 would become 2, which isn't much good when working with precice numbers =))

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] More than, less than search Function In reply to
Hi Andy,

Thanks for the reply.

I did the backup & changed the field type to INT first via Link properties & then actually got brave enough to login via PhpMySQL & updated the Cost field table to Float.

Now it works properly, however now it does not show the full results, instead is just cuts off the decimal places.

What needs to be done besides changing the field type to float?

P.s.. Suppose if I am creating a new field, then I should follow this pattern from first to make this work for search function, right?

Thanks for the help.

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [Andy] More than, less than search Function In reply to
Oh :( it kinda messed up my Cost field for entire DB.

It updated all the cost info and removed all info after decimal.

P.S. Thank you very much for reminding me to do the backup ;) it took like 45 sec to restore it. But I am gonna try playing with it again.

Looks like restore actually fixed the issue. After fixing it, it restored all the Cost data as before and link property is already set to float. So the search function seems to be working great. :)

Now any idea on how can put above options in 1 dropdown select option as
-----------------
Less than US$ 5.00
US$ 5.00 to US$ 25.00
US$ 20.00 to US$ 100.00
More than US$ 100.00
All
------------------

Thank you for the help.

Vishal

Vishal
-------------------------------------------------------

Last edited by:

SWDevil.Com: Jan 17, 2006, 11:38 AM
Quote Reply
Re: [SWDevil.Com] More than, less than search Function In reply to
Hi,

I really can't spend too much more time on this :/ (got loads of other projects to get finished off)

If you can send over GLinks access, I'll have a look for you (you'll need to restore your backup first).

There's a knack to it, but unless you've done it before, its a little slow Crazy

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] More than, less than search Function In reply to
Hi Andy,

Seems like I have been able to setup a workaround it, let me try to make it work, else will pm you the info.

Thank you again for the great help.

Vishal

Vishal
-------------------------------------------------------