I have a news tracking website, that we have migrating over to Codeigniter, i have run in to an issue with using Codeigniter Active Record - I do not have enough knowledge to figure this one out.
In the old code - we do an insert and within the insert we do a SELECT FROM to get the value for one field in the insert
$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 have tried to do this using the Active Record and I can not figure out how to do it or it maybe that you can not do it with Active Record.
I have tried a few things, my question how do you do the inline FROM in an INSERT statement with Active Record. I tried this way, and it did not work get 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 an ORM library to extend the functionality? If so what ORM library is recommended?