PDA

View Full Version : min max statement.....so close!


bkatsea
10-22-2009, 09:49 PM
7 months and the site is just about ready, just need to figure out how to incorporate the min max satement into my query. Here it is, and do I need to add into variable section in recordset query.....Whoever figures this out will have the best karma...........uh ever......NEED to pull out the minprice and maxprice query from my real estate search page with a min max statement incorporated into existing

SELECT busname, email,render_pic,MinPrice,MaxPrice,area,logo,url,e mail,map,description,tag,catch_phrase
FROM Results
WHERE STYLE LIKE 'varStyle' AND REGION LIKE 'varRegion' AND BATHROOMS LIKE 'varBathrooms' AND BEDROOMS LIKE 'varBedrooms'
ORDER BY ID desc

edbr
10-23-2009, 01:11 AM
if ive got what yu want, this page will select based on style ,region ,bathrooms . now you want to display the min price and maximum or a range in between.Is that correct?

bkatsea
10-23-2009, 02:39 PM
Yes PLEASE!!!!!

bkatsea
10-23-2009, 02:50 PM
I have two drop down lists whereby a client will say select min house value 100,000 and maximum house value 400,000 so results will pull houses meeting the values in between. Thanks in advance!

edbr
10-24-2009, 01:27 AM
lets say your your passed values are these (aes i dont know the names
min and max. then on your results page get those yalues

$min=$_POST['min'];
$max=$_POST['max'];

(just to make it clearer to read)

if($your_recordset['MinPrice'] >=$min && $your_recordset['MaxPrice'] <=$min) {

//here goes your code to echo /print your results


} //end if

that should do it

bkatsea
10-24-2009, 06:56 PM
Hello and thank you for your reply, I am just useless when stepping out of the dreamweaver code. I have placed your code in my statement but doesn't seem to be doing the trick. Have I done correctly? and thank you again.:-D

SELECT busname, email,render_pic,MinPrice,MaxPrice,area,logo,url,e mail,map,description,tag,catch_phrase,if($recordse t1['MinPrice'] >=$min && $recordset1['MaxPrice'] <=$min) {

FROM Results
WHERE STYLE LIKE 'varStyle' AND REGION LIKE 'varRegion' AND BATHROOMS LIKE 'varBathrooms' AND BEDROOMS LIKE 'varBedrooms'
ORDER BY ID desc

edbr
10-26-2009, 05:16 AM
trying to simplify , you have 3 stages 1 connect to your database
2 select
3 display

the code i gave you will filter the display , dont use it in the select

if($your_recordset['MinPrice'] >=$min && $your_recordset['MaxPrice'] <=$min) {

echo $your_recordset[' busname'];


} //end if