php - get value from a column if the point is higher than a specific amount -
okay here's table structure ,
name: reward
structure: title , point , hasimg , imgurl
i want , title , imgurl(if hasimg=1) when user has points equal to/more specific amount.
here's example. reward table filled these values(according above sequence):
1st row: ace , 1000 , 1 , http://imglink.com
2nd row: elite , 2000 , 0 , none
3rd row: pro , 3000 , 1 , http://imglink.com
a user has 3258 points , more 3000 , have title "pro". how can use mysql query select "pro" , imgurl(because hasimg=1) , store them in php variables?
if user has 2450 points , more 2000 , have title "2000" , , gets title not imgurl hasimg=0.
and how can make sure query dosent select 1000 , 2000 3000 more them?
you need highest point record in table less (or equal to) userpoints can use sql query following
select * rewards point <= 2300 order point desc limit 1 once have row can check whether image bit set , based on show image or not.
Comments
Post a Comment