- beardbar
- Tuesday, July 17th, 2007 at 1:09:06am MDT
- 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'");
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.