SQLite3查询失败。在数据库中插入数据确定,但没有得到数据,我的错是什么?
protected function db2Array($data)
{
$arr = array();
while ($row = $data -> fetchArray(\SQLITE3_ASSOC))
{
$arr[] = $row;
}
return $arr;
}
function getNews()
{
try
{
$sql = "SELECT msgs.id as id,
title,
category.name as category,
description,
source,
datetime
FROM msgs,
category
WHERE category.id = msgs.category
ORDER BY msgs.id DESC";
$res = $this->_db -> query($sql);
if(!is_object($res))
{
throw new Exception ($this->_db -> LastErrorMsg());
}
return $this->db2Array($res);
}
catch (Exception $exs)
{
//$exs -> getMessage();
return FALSE;
}
}
此代码返回:array(size = 0)empty