不了解此转换程序的elif语法错误

时间:2018-11-20 21:44:30

标签: python python-3.x python-3.6

我正在python 3中运行它,它一直告诉我有一个追溯。 elif是语法错误。我试图进行故障排除,但无法修复。在帮助我时,您可以直接修复代码,因为我不擅长实施外部代码。如果未选择以下选项,但显然无法使用,请返回您的转换。谢谢!

function listGoalkeepersForTeam() {

    $dbServername = "****";
    $dbUserrname = "****";
    $dbPassword = "****";
    $dbName = "****";

    $sql  = "select player.fname as fname, player.sname as sname, player.position as position, player.profile_img as profile_img from player_team 
    join player on player_team.player_id = player.player_id 
    join team on player_team.team_id = team.team_id 
    where team.team_id = '$id'
    AND player.position = 'Goalkeeper'";


    $conn = mysqli_connect($dbServername, $dbUserrname, $dbPassword, $dbName);
    $query = mysqli_query($conn, $sql);

    if (!$query) {
        die ('SQL Error: ' . mysqli_error($conn));
    }
    ?>
       <?php
       $no  = 1;
       $total   = 0;
       while ($row = mysqli_fetch_array($query))
       { ?>

                <img class="rounded-circle img-fluid d-block mx-auto mr-4" src="img/db_img/players/child.png" alt="<?php echo ($row['fname']. " " .$row['sname']) ?>">
                <h3><?php echo ($row['fname']. " " .$row['sname']) ?><br>
                <small><?php echo ($row['position']) ?></small>
                </h3>


<?php      $no++;
       } 

}

1 个答案:

答案 0 :(得分:2)

Python希望条件语句中包含一些代码(至少一行)。如果您现在没有任何内容,可以输入pass

if conversion == "mm":
    #selection = "metric to metric conversions!"
    pass
elif conversion == "mi":
    #selection = "metric to imperial conversions!"
    pass
elif conversion == "w":
    #selection = "water conversions!"
    pass
elif conversion == "p":
    #selection = "physics equations!"
    pass
elif conversion == "m":
    #selection = "maths equations!"
    pass
elif conversion == "q":
    #selection = "quick facts!"
    pass