douyue6520 2012-02-01 09:27
浏览 13
已采纳

需要一些关于php点系统的指导

am trying to build a point system which checks how much points a user have and gives a specific title to them.

I have prepared a table which the php script can refer to when checking which title should be given to a member.

MYSQL Table structure as follows:
name: ptb
structure: pts , title

For example , if you have 100 points , you gain the title - "Veteran" , if you have 500 points , you gain the title "Pro". let's say i have pts:100 , title:veteran and pts:500 , title:pro rows in the ptb table.

However i stumble upon a confusing fact.
How can i use php to determine which title to give the user by using the ptb table data?

If a user have equal or more than 100 points will gain Veteran for title BUT 500 is also MORE THAN 100 which means the php script also needs to make sure it is below 500pts .

I still not sure how to use php to do this. as i am confused myself. I hope someone could understand and provide me some guidelines.

THANKS!

  • 写回答

2条回答 默认 最新

  • doujiyong7604 2012-02-01 09:32
    关注

    You select all records with enought points, sort the one with the highest score to the top and cut out the rest.

    SELECT title FROM ptb WHERE pts <= $points ORDER BY pts DESC LIMIT 1
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 fastreport怎么判断当前页数
  • ¥15 Kylin-Desktop-V10-GFB-Release-JICAI_02- 2207-Build14-ARM64.iso有没有这个版本的系统啊
  • ¥15 能不能通过蓝牙将传感器数据传送到手机上
  • ¥20 100元python和数据科学实验项目
  • ¥15 根据时间在调用出列表
  • ¥15 R 包chipseeker 安装失败
  • ¥15 Veeam Backup & Replication 9.5 还原问题
  • ¥15 vue-print-nb
  • ¥15 winfrom的datagridview下拉框变成了黑色,渲染不成功
  • ¥20 利用ntfy实现短信推送