警告:mysqli_fetch_row() 期望参数 1 为 mysqli_result,C:\wamp\www\widget_corp\data_base.php 中给出的空值

Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, null given in C:\wamp\www\widget_corp\data_base.php

我正在尝试 select 来自 MySQL table 的数据,但我收到此警告:

Notice: Undefined variable: result in C:\wamp\www\widget_corp\data_base.php on line 40

还有这个:

Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, null given in C:\wamp\www\widget_corp\data_base.php on line 40

这是我的代码:

   $connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);

    // Test if connection occured

    if (mysqli_connect_errno()){
        die ("Database connection failed: " . mysqli_connect_errno() . " (" . 
            mysqli_connect_errno() . ")"  );
    }

    // Perform database query
    $query = "SELECT * FROM subjects " ; 
    $resut = mysqli_query($connection, $query);

    // Test if there was a query error
    if (!$resut){
      die ("Database connection failed!");
    }

    // Use return data if any
    while ($row = mysqli_fetch_row($result)){
      //output data from each row
      var_dump($row);
      echo "<hr />";
    }

while() 之前一切正常。有 suggestions/solutions 吗?提前致谢!

注意点,语法错误:

$resut = mysqli_query($connection, $query);

改为:

$result = mysqli_query($connection, $query);

也改为:

if (!$result){
      die ("Database connection failed!");
}