drde3456 2014-10-19 07:37
浏览 10

php:当有一位数字时找不到最大值

I used the following codes to find the maximum value of marks

 <?php
  $sql = mysql_query("SELECT MAX(marks) FROM participant ");
  $fetch = mysql_fetch_row($sql);
  $max_m = $data[0];


  $sql = mysql_query("SELECT st_name FROM participant WHERE marks='$max_m'");
  $fetch = mysql_fetch_row($sql);
  $st = $data[0];
  echo $st;
  ?>

but when I insert a mark that is 2-9 to test, the output become the student with that marks.

How to solve the problem? It works when i use 1 and the number between 10 and 20.(the full mark is 20)

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)