php - column type and if statement -


guys!
want make statement: cost 1-3 -> maximum in inventory = 10
cost 4-6 -> maximum in inventory = 5
cost 7-9 -> maximum in inventory = 3
cost on 10 -> maximum in inventory = 1

when product cost db, example 6.00, works, but, if product cost db example 6.50, doesn't work, i've tried these types column : double,float,int of them didn't work me :'(
code

     if($fetch->product_cost >=1 , $fetch->product_cost <= 3){         print "         <td width='10px'>10</td>         ";         }elseif($fetch->product_cost >=4 , $fetch->product_cost <= 6){         print "         <td width='10px'>5</td>         ";         }elseif($fetch->product_cost >=7 , $fetch->product_cost <= 9){         print "         <td width='10px'>3</td>         ";         }elseif($fetch->product_cost <=10){         print "         <td width='10px'>1</td>         ";         } 

since you're using php , don't expect native mysql solution easiest way run 3 separate mysql queries, employing between capability. example

select * table product_cost between 4 , 6


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -