I am able to get the last inserted id using $this->db->insert_id();
in codeigniter, is there any way that I can get the id of the last updated record? I tried
$this->db->insert_id();
this will give only inserted id. For getting the updated row id you can add a column as lastmodified (timestamp) and update this column with current timestamp everytime you run the update query. After your update query just run this:
$query = $this->db->query('SELECT id FROM StockMain ORDER BY lastmodified DESC LIMIT 1');
$result = $query->result_array();
You will get the id in the result set.