Код: Выделить всё
$condition = uid = '4' AND id = '1';- Мой контроллер
Код: Выделить всё
$fields = "id";
$condition = "";
if($condition) {
$condition.=" AND ";
}
if($json_decoded->userId) {
if($condition) {
$condition.=" AND ";
}
$condition.=" uid = '".$json_decoded->userId."'";
}
if($json_decoded->listId) {
if($condition) {
$condition.=" AND ";
}
$condition.=" id = '".$json_decoded->listId."'";
}
$checkExist = $this->mdl_details->getDetailByIdandUid($fields,$condition);
- Функция «Мои модели»
Код: Выделить всё
$this->db->select($fields);
$this->db->from(TBL_DETAILS);
if(!empty($condition)) {
$this->db->where($condition);
}
$query = $this->db->get()->row();
echo $this->db->last_query(); die;
return $query;
Номер ошибки: 1054Неизвестный столбец ' uid = '4' И id = '1'' в пункте 'where'
SELECT `id` FROM (`guide`) WHERE ` uid = '4' AND id = '1'
Как избавиться от этого символа обратной кавычки (`) в запросе?
Подробнее здесь: https://stackoverflow.com/questions/296 ... s-manually
Мобильная версия