📌  相关文章
📜  警告:mysqli_fetch_array() 期望参数 1 为 mysqli_result,字符串在 - PHP 代码示例中给出

📅  最后修改于: 2022-03-11 14:54:27.835000             🧑  作者: Mango

代码示例5
mysqli_fetch_array()'s 1st parameter must be a result of a query. What you are doing is you are passing the connection (which doesn't make sense) and the query command itself.

To fix this, execute the query first, then store the result to a variable then later fetch that variable.

$sql = "select * from privinsi";
$result = mysqli_query($connection,$sql);
while($r = mysqli_fetch_array($result))
{
    // your code here
}