我有一个codeIgniter / PHP模式,我想插入一些数据到数据库中。
I have a CodeIgniter/PHP Model and I want to insert some data into the database.
不过,我在我的原始的SQL查询这组:
However, I have this set in my 'raw' SQL query:
ON DUPLICATE KEY UPDATE duplicate=duplicate+1
我使用codeIgniter和我将我所有的previous在控制器的SQL查询为的ActiveRecord 。有没有办法从ActiveRecord的基础模型内做到这一点?
I am using CodeIgniter and am converting all my previous in-controller SQL queries to ActiveRecord. Is there any way to do this from within the ActiveRecord-based model?
谢谢!
杰克
该脚本是pretty的俏皮: 的http://web.archive.org/web/20090221091226/http://$c$cigniter.com/forums/viewthread/80958/
This script is pretty nifty: http://web.archive.org/web/20090221091226/http://codeigniter.com/forums/viewthread/80958/
(试行一个在最底层,还没有尝试过自己,但它看起来好了)
(try the one at the very bottom. Haven't tried it myself but it looks alright)