Converting sql statement to codeigniter query

I have the following mysql query which is

UPDATE crm_logs SET status_from=substring_index(substring_index(action, 'from', -1),
                       'to', 1) AND REPLACE ("status_from", ' ', '');

Which takes in a column called action in my table and checks for a word in the string that is after from and before to and displays it on my status_from column. I am using CodeIgniter as my PHP framework. So I want the CI version of creating this particular entry.