我正在尝试调试我的第一个正式 CodeIgniter 应用程序中的一些代码,但我似乎无法找到可以简单地获取我的 ActiveRecord 代码刚刚生成的原始 SQL 的位置。
$where = 'DAY(`datetime_start`) = '. date('d',$day) .' AND ';
$where .= 'MONTH(`datetime_start`) = '. date('m',$day) .'';
$this->db->from('events')->where($where);
$result = $this->db->get();
感谢您的帮助!
最佳答案
查询运行前:
$this->db->_compile_select();
在它运行之后:
$this->db->last_query();
关于php - 在 CodeIgniter 1.7 中获取原始 SQL 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1507710/