codeigniter活动记录,生成,但不执行查询 [英] codeigniter active record, generate, but do not execute query
本文介绍了codeigniter活动记录,生成,但不执行查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在一个需要被送入SQL查询字符串待办事项其工作库。
I am working a library that needs to be fed sql queries as strings todo its job.
我使用codeIgniter和活动记录的实现他们的数据库类的。
I am using CodeIgniter and the active record implementation of their database class.
我知道,我可以附和SQL语句,像这样......但我只想要生成这个查询,不执行它。
I know that I can echo the SQL statement like so... But I only want to generate this query, not execute it.
echo $this->db->last_query();
任何帮助完成,这将是伟大的!
Any help accomplishing this would be great!
推荐答案
在last_query()函数,你正在使用返回查询字符串,它不执行它。尝试分配函数返回一个变量用在库中。
The last_query() function you are using returns the query string, it doesn't execute the it. Try assigning the function return to a variable for use in your library.
$str = $this->db->last_query();
这篇关于codeigniter活动记录,生成,但不执行查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文