Object can't be converted to a string in MySQLi PHP

后端 未结 3 1434
眼角桃花
眼角桃花 2020-12-12 07:20

Catchable fatal error: Object of class mysqli_result could not be converted to string in C:\\xampp\\htdocs\\xxx\\dash.php on line 20

I a

3条回答
  •  暖寄归人
    2020-12-12 07:46

    if ($result = $mysqli->query($query)) {
        while($row = $result->fetch_object()) {
                echo row['column_name'];
            }
    }
    $result->close();
    

    where you see 'column_name put the name of the column you want to get the string from.

提交回复
热议问题