iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-26-2008, 12:38 PM
WebProWorld Pro
 
Join Date: Jul 2003
Location: Canada
Posts: 272
ackerley1 RepRank 0
Default Problem with Search Filters

Hello,

I am using a acme agent real estate listing program for my site and I have made a few modifications to it. My problem arises when I try to filter my search results by price (min or max). If I use any filters (lets say min $100000 and max $300000) it will not return only those results. It will return all results regardless of price. here are some code snippets that I believe contribute to this but I can't seem to narrow it down:
(this is near the start where I assume it checks if they are set and assign it if not)
[code]
if(!isset($_GET["min_price"]))
$min_price = $_SESSION["min_price"];
else
$min_price = $_GET["min_price"];


if(!isset($_GET["max_price"]))
$max_price = $_SESSION["max_price"];
else
$max_price = $_GET["max_price"];
[\code]
(and what I believe is the sql query)
[code]
$sqlCnt = "SELECT COUNT(c.id)
FROM ".$db_prefix."listings AS c
INNER JOIN ".$db_prefix."sellers AS d ON d.id=c.member_id
WHERE
d.status='Active'
AND (c.mls LIKE '%$mls%' OR '$mls'='')
AND (c.category LIKE '%$category%' OR '$category'='')
AND (c.lstate LIKE '%$lstate%' OR '$lstate'='')
AND (c.bath >= '$bath' OR '$bath'='')
AND (c.beds >= '$beds' OR '$beds'='')
AND (c.price >= '$min_price' OR '$min_price'='')
AND (c.price <= '$max_price' OR '$max_price'='')
".$filterKeyword."
".
//AND (d.zip LIKE '%$zip%' OR '$zip'='')
$zipstring."
AND (c.member_id='$dealer_id' OR '$dealer_id'='')";
[\code]

If you want to view the live site and test for yourself, then please look here: www.belize-realestate-investments.com

If you want the actual file msg me and I will send it to you.

Any help with this would be greatly appreciated.

Thanks

Rob
__________________
Rob
Reply With Quote
  #2 (permalink)  
Old 05-31-2008, 07:43 PM
kgun's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: May 2005
Location: Norway
Posts: 5,689
kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9
Default Re: Problem with Search Filters

There seem to be a problem with your webserver. When I put the link in your signature in my browser, I get the following warnings and errors.

Warning: main(counter/phpcounter.php) [function.main]: failed to open stream: No such file or directory in /home/sovweb/public_html/index.php on line 104

Warning: main(counter/phpcounter.php) [function.main]: failed to open stream: No such file or directory in /home/sovweb/public_html/index.php on line 104

Warning: main(counter/phpcounter.php) [function.main]: failed to open stream: No such file or directory in /home/sovweb/public_html/index.php on line 104

Fatal error: main() [function.require]: Failed opening required 'counter/phpcounter.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/sovweb/public_html/index.php on line 104

If that is not the problem:

Quote:
Originally Posted by ackerley1 View Post
Hello,
I am using a acme agent real estate listing program for my site and I have made a few modifications to it. My problem arises when I try to filter my search results by price (min or max). If I use any filters (lets say min $100000 and max $300000) it will not return only those results. It will return all results regardless of price. here are some code snippets that I believe contribute to this but I can't seem to narrow it down:
What datatype do you use for min and max?

Last edited by kgun; 05-31-2008 at 07:45 PM.
Reply With Quote
  #3 (permalink)  
Old 05-31-2008, 07:51 PM
WebProWorld Pro
 
Join Date: Jul 2003
Location: Canada
Posts: 272
ackerley1 RepRank 0
Default Re: Problem with Search Filters

Yes, unfortunately (in some regards) I have not been able to maintain my own site... fortunately, it has been because I am too busy

It will be migrating to a new name and look in the near future.

Any help with the problem that I posted though would be great
__________________
Rob
Reply With Quote
  #4 (permalink)  
Old 05-31-2008, 08:02 PM
kgun's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: May 2005
Location: Norway
Posts: 5,689
kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9
Default Re: Problem with Search Filters

Quote:
Originally Posted by ackerley1 View Post
Any help with the problem that I posted though would be great
That was why I wrote the second part of my post.
Reply With Quote
  #5 (permalink)  
Old 05-31-2008, 08:08 PM
WebProWorld Pro
 
Join Date: Jul 2003
Location: Canada
Posts: 272
ackerley1 RepRank 0
Default Re: Problem with Search Filters

Ah... overlooked that...

Not sure what you mean by datatype though? Regular form drop down option list.
__________________
Rob
Reply With Quote
  #6 (permalink)  
Old 05-31-2008, 08:30 PM
kgun's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: May 2005
Location: Norway
Posts: 5,689
kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9
Default Re: Problem with Search Filters

Ok, then you are new to programming. The following are data types:
  1. Short int
  2. Int
  3. Long int.
  4. Float
  5. Double.
with "increasing" bounderies for max (and min). If the datatype is short int you may go outside these bounderies.

Link: C Data types

Last edited by kgun; 05-31-2008 at 08:35 PM.
Reply With Quote
  #7 (permalink)  
Old 05-31-2008, 08:44 PM
kgun's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: May 2005
Location: Norway
Posts: 5,689
kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9
Default Re: Problem with Search Filters

Quote:
Originally Posted by ackerley1 View Post
Code:
$sqlCnt = "SELECT COUNT(c.id)
         FROM ".$db_prefix."listings AS c
         INNER JOIN ".$db_prefix."sellers AS d ON d.id=c.member_id
         WHERE 
         d.status='Active'
         AND (c.mls LIKE '%$mls%' OR '$mls'='')
         AND (c.category LIKE '%$category%' OR '$category'='')
         AND (c.lstate LIKE '%$lstate%' OR '$lstate'='')
         AND (c.bath >= '$bath' OR '$bath'='')
         AND (c.beds >= '$beds' OR '$beds'='')
         AND (c.price >= '$min_price' OR '$min_price'='')
         AND (c.price <= '$max_price' OR '$max_price'='')
         ".$filterKeyword."
         ".
         //AND (d.zip LIKE '%$zip%' OR '$zip'='')
         $zipstring."
         AND (c.member_id='$dealer_id' OR '$dealer_id'='')";
My bolding.

Inner joins, definitely not for beginners.

And that query " ... " is not short. I would have stripped it down to a minimum, printed it out and expanded it step by step printing it out in every step to see that it is OK.

Last edited by kgun; 05-31-2008 at 08:51 PM.
Reply With Quote
  #8 (permalink)  
Old 06-04-2008, 03:23 PM
WebProWorld Pro
 
Join Date: Jul 2003
Location: Canada
Posts: 272
ackerley1 RepRank 0
Default Re: Problem with Search Filters

Sorry for the delay in getting back to you.

I check the data type and is sufficient (varchar (255)).

Also I did not program this so some of it is way outside my expertise. How would you replace the inner join with something simpler?

Could I send you the php file and have you look at it to make a recommendation?

Thanks

Rob
__________________
Rob
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FeedPlex Adds New Search Filters WPW_Feedbot Search Engine Optimization Forum 0 07-11-2005 10:30 AM
Need Help With Spam Filters Test prattboy Introductions 1 02-25-2005 12:56 PM
New filters on the horizon? activeco Google Discussion Forum 2 02-04-2005 12:53 AM
to get through the filters hkaamir Marketing Strategies Discussion Forum 12 05-07-2004 04:11 AM
Water Filters - in australia David Pearson Marketing Strategies Discussion Forum 0 02-22-2004 08:31 PM


All times are GMT -4. The time now is 02:09 PM.



Search Engine Optimization by vBSEO 3.3.0