Php 类SQLite3Result的对象无法转换为int(COUNT和EXISTS)
伙计们,我想做的是检测一个数据是否存在,但我得到的是结果不能转换成int。 “无法在中将类SQLite3Result的对象转换为int” 代码如下:Php 类SQLite3Result的对象无法转换为int(COUNT和EXISTS),php,html,mysql,database,sqlite,Php,Html,Mysql,Database,Sqlite,伙计们,我想做的是检测一个数据是否存在,但我得到的是结果不能转换成int。 “无法在中将类SQLite3Result的对象转换为int” 代码如下: $result = $db->query('SELECT EXISTS (SELECT 1 FROM authorized_personnel WHERE Username = $username);'); //i've also tried COUNT(*) and i'm getting the same error s
$result = $db->query('SELECT EXISTS (SELECT 1 FROM authorized_personnel WHERE Username = $username);'); //i've also tried COUNT(*) and i'm getting the same error
settype($result, "integer"); //i've also tried putting and removing settype() and im getting the same error
if ($result == 1)
{
echo "found";
}
else if ($result == 0)
{
echo "not found";
}
伙计们,我应该在条件语句中添加什么?这是否回答了您的问题?