codeigniter-3 - 为什么从 codeigniter 2.6 迁移到 codeigniter 3 后出现 DB 错误?
问题描述
为什么从 CodeIgniter 2.6 迁移到 CodeIgniter 3 后出现 DB 错误?
它在表名后添加“,0”。
Ex- SELECT id
, title
, title_url
FROM tablename
, 0 WHERE isEnabled
= 'Y' ORDER BY date
DESC LIMIT 1
解决方案
public function functionName()
{
$this->db->select('id, title, title_url');
$this->db->from('tablename');
$this->db->where('isEnabled','Y');
$this->db->order_by('date','desc');
$this->db->limit(1);
$query = $this->db->get()->result();
return $query;
}
试试这个。
推荐阅读
- python - 整数如何映射到 4 个字节?如何在python中将4个字节转换为整数
- reactjs - 如何为 setState 中的数组元素设置值
- javascript - 如何将图像编码为base64
? - html - 图像周围的动画圆形边框?
- vue.js - 组件的 vue.js 自定义 css(没有 webpack 和 vue-loader)
- javascript - 此页面显示用户在文本框部分输入的值
- web2py - Web2py:如何将参数从视图传递到控制器以从数据库中删除记录
- python - 实现 Base64VideoField Django REST
- java - 如何根据条件在rest-api调用之间放置等待时间
- html - “刷新”行数据后的数据表列宽问题