CI中同時使用WHERE語句我有以下錯誤如何在CodeIgniter中的where條件中使用select?
A PHP Error was encountered
Severity: Warning
Message: preg_match(): Compilation failed: a numbered reference must not be zero at offset 34
Filename: database/DB_driver.php
Line Number: 1543
Backtrace:
File: D:\xampp\htdocs\manojgame\application\models\Main_model.php
Line: 34
Function: where
File: D:\xampp\htdocs\manojgame\application\controllers\Games.php
Line: 21
Function: select_data_bytitle
File: D:\xampp\htdocs\manojgame\index.php
Line: 262
Function: require_once
我的說法是:
$this->db->select('*');
$this->db->from('games');
$this->db->where('cat_type',1);
$query = $this->db->get();
if ($query->num_rows() > 0) {
$row = $query->row_array();
return $row;
}
,如果我有刪除
$this->db->where('cat_type',1);
代碼運行完美。 如何使用條件?下面的代碼