1
我有PHP類如下:SQLSTATE [42000]:語法錯誤或訪問衝突:1065查詢爲空(SQL:)
class SearchAttributeDao extends BaseDao
{
private $SELECT_CATEGORY_FILTER_BY_IDS;
function __construct()
{
$this->table_name = 'categoryattributes';
$this->SELECT_CATEGORY_ATTR_BY_IDS = "SELECT csa.attributeid, atn.name FROM "
.$this->table_name.
" csa join attributenames atn on csa.attributeid = atn.attributeid where csa.categoryid in (?); ";
}
public function getListByCatIds(array $catIds)
{
//...
$attr_list = $this->executeSelectQuery($this->SELECT_CATEGORY_FILTER_BY_IDS, [$catIds]); //Error on this line
//...
}
}
所以,當我執行我的應用程序,我得到一個錯誤,指出:
SQLSTATE [42000]:語法錯誤或訪問衝突:1065查詢是空的(SQL:) ... 在BaseDao-> executeSelectQuery(null,數組(陣列( '10523', '10524',「10606 ','10423','10533','10618')))in SearchAttributeDao.php line 24
上面的堆棧跟蹤表明SELECT_CATEGORY_FILTER_BY_IDS
爲空或空,但我已經在構造函數中設置它。我做錯了什麼?
我告訴你,我笨:/ – Tariq