mysqli_fetch_array()错误

时间:2017-02-17 04:12:40

标签: php

<?php
    $con = mysqli_connect('localhost','root','','db') or die('Error connecting to MySQL server.');

    if(isset($_POST['rollNo'])){
        $rollNo = $_POST['rollNo'];

        $query = "Select * from table where ROLL_NUMBER LIKE '$rollNo'";
        $select = mysqli_query($con, $query);

        printf(mysqli_query($con));
        while ($row = mysqli_fetch_array($select)) {
            echo $row['FIRST_NAME'];
        }


    }
?>

显示错误

  

mysqli_fetch_array()期望参数1为mysqli_result,给定布尔值。

1 个答案:

答案 0 :(得分:0)

使用以下代码段

    while($row = mysqli_fetch_assoc($result))
    {
        echo $row['FIRST_NAME'];
    }