我的错误是
"Object of class mysqli_result could not be converted to string"
我的代码错误行是:
$type = queryMysql("SELECT `type` FROM `register` WHERE `name` = '$name'");
echo "$type";
if ($type == "admin")
{
die("Welcome back Admin $name <br> you can go to the control panel by clicking <a href='#'>here</a>");
}
elseif ($type == "user")
echo "Welcome back user $name.";
“type”在数据库中定义为“admin”或“user”,错误行为“echo '$type';"
答案 0 :(得分:0)
您的函数queryMysql
不返回字符串,但会返回myslqi_result
。你应该这样对待它,而不是作为一个字符串