Home | Products | Consulting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Results link - min value in link

 

 


rjbathgate
User

Jun 19, 2008, 3:39 PM

Post #1 of 5 (570 views)
Shortcut
Results link - min value in link Can't Post

Hi again,

I want a create a link (e.g. for a popular search) which displays results with a minimum price, but can't get it to work...


Code
<p><a href="results.php?price=1,000,000">Property over &pound;1,000,000</a></p> 
<p><a href="results.php?price_min=2,000,000">Property over &pound;2,000,000</a></p>


So in the above the first one simply gives me results when price is exactly 1,000,000... whereas the second (price_min_ doesn't work - just gives me all results.

The price_min works fine in my search engine, but not on this direct link.

Is there something i'm missing?

Thanks in advance,

Rob


Dave
Staff / Moderator


Jun 19, 2008, 4:22 PM

Post #2 of 5 (568 views)
Shortcut
Re: [rjbathgate] Results link - min value in link [In reply to] Can't Post

Hi Rob,

Try the numeric search ranges are picky - they don't understand commas. Try removing the commas from the link and let me know if that fixes it.


Code
<p><a href="results.php?price_min=1000000">Property over &pound;1,000,000</a></p>  
<p><a href="results.php?price_min=2000000">Property over &pound;2,000,000</a></p>


Dave Edis - Senior Developer
interactivetools.com


rjbathgate
User

Jun 19, 2008, 4:45 PM

Post #3 of 5 (566 views)
Shortcut
Re: [Dave] Results link - min value in link [In reply to] Can't Post

Hi Dave,

Thanks for the reply.

Without the commas, it does and doesn't work...

The prices set within the records DO have commas (i.e. displaying as 2,000,000). So when searching:


Code
<p><a href="results.php?price_min=1000000">Property over &pound;1,000,000</a></p>


...because we're not using commas in the price_min in the link, it displays no results, because the results records DO have commas.

The commas work fine in a select search engine, for example:


Code
<select name="price_min"> 
<option value="1,000,000">1,000,000</option>
</select>


We want to keep the commas in displayed records as otherwise we're loosing the neatness and style.

If the direct link won't work with commas, I guess I would need to build the direct link in as a form - a hidden <select> field (to take the price_min with commas) with a submit button which is just the link text - so there probably is a way around it, but not as easy or simple as a quick link...

Cheers
Rob


Dave
Staff / Moderator


Jun 19, 2008, 4:54 PM

Post #4 of 5 (563 views)
Shortcut
Re: [rjbathgate] Results link - min value in link [In reply to] Can't Post

Hi Rob,

There shouldn't be a difference between a text link and a form. So if you double check that and you're getting different results let me know.

Typically what you need to do is have only numeric values in the database and search values. It's a limitation of MySQL that in order to do numeric comparisons it needs no commas. You can prevent the entry of commas by using the field editor and making only "1234567890." allowed characters for the price field.

You can display the price formatted with commas (even if they're not in the database) by using the number_format() function. See this post for more details: http://www.interactivetools.com/iforum/P62471#62471

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com


rjbathgate
User

Jun 19, 2008, 5:21 PM

Post #5 of 5 (553 views)
Shortcut
Re: [Dave] Results link - min value in link [In reply to] Can't Post

Ah ha, have figured it...

It works when there is just one comma, for example:


Code
<p><a href="results.php?price_min=900,000">Property over &pound;900,000</a></p>


but not when there is more than one, for example:

Code
<p><a href="results.php?price_min=2,000,000">Property over &pound;2,000,000</a></p>


So I think i'll resort to price being number only (no commas) and then using number_format() - more ability to restrict field entry in CMS too by just allow numbers.

Cheers for your help - strange how 1 comma works!

Rob

 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4