---------------|--------------hosting Space------------------| QUANTITY------1 GB----------------3 GB ----------------10 GB ---10------------$50----------------$60------------------$70 ---20------------$80---------------$100-----------------$120 ---30------------$90---------------$130-----------------$150 The above table is given to server database ( in sql ) User will input hosting space and quantity when he submit web page will give him/her the price. Example-- ( by red color value) 1. User will input in quantity field---20 2. User will input in Space field ----3 3. User will click in submit button the result shown in screen that " ur price is $100" Please give me detail how can I do that. another for advance mode Now I need also another answer. User can customize their offer . If user want hosting space of 10GB and a quantity of 23 then what will be the price. Procudure is. Price= $120+ [($150-$120)/(30-20)]*(23-20)= $129 So the result will be $129 whe user input 23 in quantity field and 10 in space field
do you use a class for array convertion of you query? if not convert first your table into php array (it will lessen the work load of the server) sample $sampleArray = array(); while($aaa = mysql_fetch_array($bbb)) { array_push($sampleArray,$aaa); } echo "<pre>"; print_r($sampleArray); echo "</pre>"; at this point it will be your logic to do your equations.. in your table example it will be 2 to 3 dimensional array, doing a double for loop for this..