Object of class mysqli_result could not be converted to string in

前端 未结 5 2213
遥遥无期
遥遥无期 2020-11-22 13:24

I am getting the error:

Object of class mysqli_result could not be converted to string

This is my code:

$result = mys         


        
5条回答
  •  暖寄归人
    2020-11-22 13:59

    The mysqli_query() method returns an object resource to your $result variable, not a string.

    You need to loop it up and then access the records. You just can't directly use it as your $result variable.

    while ($row = $result->fetch_assoc()) {
        echo $row['classtype']."
    "; }

提交回复
热议问题