MySQL Forums
Forum List  »  PHP

Re: how I filter car quote per price min max... in other words how complex calc works
Posted by: Leonidas Savvides
Date: March 02, 2014 10:47AM

the hard part is give min & max totals filter quote so final price of cars is inside that range...:
user move two point jQ slider
move listener pass current values to php via ajax, the min,max=$priceLow,$priceHigh
MySQL Using query calculates only finalprice cars inside the limit...
calc
$rate // t2 TABLE t2.l = low season price, m=medium, h=high
if ($tsm14>$tsp) {
$rate="t2.l";
} else if ($tsh14>$tsp) {
$rate="t2.m";
} else if ($tsl14>$tsp) {
$rate="t2.h";
} else if ($tsm15>$tsp) {
$rate="t2.l";
} else if ($tsh15>$tsp) {
$rate="t2.m";
} else if ($tsl15>$tsp) {
$rate="t2.h";
}


$days=7
$database->query('SELECT * FROM cars t1 INNER JOIN prices t2 ON t1.cat= t2.cat WHERE '.$priceLow.' < (('.$rate.' * '.$days.')-('.$rate.' * '.$days.')*t1.discount)*1.18 AND '.$priceHigh.' > '.$rate.' * '.$days.';' );

I think works ... is it ok...??? I am working now on it. btw using database.php library



Edited 1 time(s). Last edit at 03/02/2014 10:47AM by Leonidas Savvides.

Options: ReplyQuote


Subject
Written By
Posted
Re: how I filter car quote per price min max... in other words how complex calc works
March 02, 2014 10:47AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.