All pastes #622937 Raw Edit

beardbar

public text v1 · immutable
#622937 ·published 2007-07-17 07:09 UTC
rendered paste body
I am trying to wrap my head around the best way to write a query for the following circumstances I know it should be easy but i get very confused when it comes to less then and greater thens. 

I have 1 table that contains the following columns

rank_id, rank_title, rank_min, rank_image

I have a variable $postCount

I need a query that will take my post count, and compare it to the returned results and pull the correct row of which the postCount falls into. 
rank_min is the ranks post count minium. example

rank 1 = 10 posts
rank 2 = 20 posts
rank 3 = 30 posts

if my user has 22 posts, the query should return rank 2. if my user has 31 posts it should return rank 3. 

so far i have

$database->setQuery("SELECT * FROM fb_ranks WHERE rank_min >= '$postCount'");