gpt4 book ai didi

php - 可捕获的 fatal error : Object of class mysqli could not be converted to string in what is ment buy it beind an object?

转载 作者:行者123 更新时间:2023-12-01 00:23:40 24 4
gpt4 key购买 nike

我已经在这个网站上有一段时间了,我似乎无法理解大多数类似问题都能得到这个错误的答案:

Catchable fatal error: Object of class mysqli could not be converted to string

说它是一个对象。我是 PHP 的新手,如果有人能向我解释这一点,那将非常有帮助。我正在尝试从我的数据库中检索数据并将其回显到表中。

这是我到目前为止所做的:

$dbcon=mysqli_connect("localhost","root","","technoage");

if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$results = mysql_query("SELECT * FROM items WHERE item_id = 1,$dbcon");
if(!$results)
{
die("Database query failed".mysql_error());
}
while($row = mysql_fetch_array($results))
{
echo $row['descreption']." ".$row['price']."<br/>";
}

最佳答案

您已连接到 mysqli

但是你正在使用 mysql 查询

$results = mysql_query("SELECT * FROM.....

关于php - 可捕获的 fatal error : Object of class mysqli could not be converted to string in what is ment buy it beind an object?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19245473/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com