I have a news tracking site that we have moved to Codeigniter, I have encountered a problem using Codeigniter Active Record - I donβt have enough knowledge to understand this.
In the old code - we insert and inside the insert do SELECT FROM to get the value for one insert field
$this->db->query("INSERT INTO news_item_keywords_link (news_item_keyword, keyword) SELECT $version_id, keyword FROM news_item_keywords_link WHERE news_item_keyword=$old_version
I tried to do this using Active Record, and I cannot figure out how to do this, or maybe you cannot do it using Active Record.
I tried several things, my question is how do you do inline FROM in an INSERT statement with Active Record. I tried this way and it did not help to get a syntax error, any suggestions.
if ($this->db->insert('news_item_keywords', Array( 'news_item_keyword' => $version_id, 'keyword' => $this-db->select('keyword') ->from('news_item_keywords') ->where('news_item_keyword', $old_version); ))) {
Should I install the ORM library to extend functionality? If so, is the ORM library recommended?
source share