案例----查询成绩

HTML





  
  
  
  Document



  
学号:

PHP





  
  
  
  Document



  
"张三", "chinaese" => "140", "math" => "149", "english" => "120"); $arr['124'] = array("username" => "李四", "chinaese" => "40", "math" => "142", "english" => "10"); $arr['125'] = array("username" => "王五", "chinaese" => "120", "math" => "12", "english" => "20"); $arr['126'] = array("username" => "赵六", "chinaese" => "110", "math" => "119", "english" => "50"); // 如果是管理员,则遍历所有成绩 if ($code == 'admin') { foreach ($arr as $key => $value) { echo "
  • 姓名:$value[username]
  • 语文:$value[chinaese]
  • 数学:$value[math]
  • 英语:$value[english]
"; } } else { // 所输入学号的成绩 $score = $arr[$code]; echo "
  • 姓名:$score[username]
  • 语文:$score[chinaese]
  • 数学:$score[math]
  • 英语:$score[english]
"; } ?>

你可能感兴趣的:(案例----查询成绩)