Gossamer Forum
Home : Products : DBMan : Customization :

price range troubles.. min/max

Quote Reply
price range troubles.. min/max
Im trying to figure out and get my price range working ie min/max..

if I search using 80000 > 100000 Euros it works..

if I search using 80,000 > 100,000 Euros it does´nt works..

This the link to see what I mean.. copy and paste this url..

http://www.visaverde.com/cgi-bin/canarias/property/db.cgi?db=default&uid=default&language=eng&view_search=1

Having read a few posts I tried to put..

1 while $in{'Price'} =~ s/,//g; # takes out any commas.

In my "sub html_record_form" just under "my (%rec) = @_;"

This, as I had hoped, had not strip these commas when you submit and search the database.. I guess there is some other way to do this..

Help is always appreciated.. Justin

Last edited by:

JustinS: May 9, 2002, 6:42 AM
Quote Reply
Re: [JustinS] price range troubles.. min/max In reply to
If your using a price range search you may want to see the mod written for doing so and use the examples provided. There are also posts in the FAQ for how to do greater than - less than searches.

In a database where I have a greater than - less than having people enter >1,000 < 3,000 for instance I use:

sub html_record and or sub html_record_long:

1 while $rec{'Price'} =~ s/(\d)(\d{3})\b/$1,$2/; ## add commas back into price
$rec{'Price'} = "\$" . $rec{'Price'}; ## adds dollar sign back into price field


In my .cgi file in sub add_record I have:

$in{'Price'} =~ s/,//g; ### remove comma from entry

Then in sub query i have:

if ($in{'Price-gt'}) { --$in{'Price-gt'};}
if ($in{'Price-lt'}) { ++$in{'Price-lt'};}


Then in my search form I use:

<TR><TD colspan=2><$font>Prices are setup to do greater than or less than searches. DO NOT use commas!<P>
<CENTER>Price: \$ <INPUT TYPE="TEXT" NAME="Price" SIZE="6" VALUE="$rec{'Price'}"></CENTER><P>
For example to search for: greater than 1000 you would type '>1980' in the field. For less than 1000 you would type '<10000' in the field.</font></TD></TR>

You might want to check out JPDeni's "Price Range Select Field" to setup your range searches differently? If so this is the url:
http://www.jpdeni.com/dbman/Mods/PriceRange.txt

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/