Welcome Guest, Not a member yet? Register   Sign In
Routing problem
#2

[eluser]tonanbarbarian[/eluser]
Code:
$this->db->insert_id();
Will return the id of the last record inserted.

If your Add_comment method only ever adds, not updates, the comments then you can simply use the above code to determine the id
My suggestion would be to put some clode in the model to store the id as a property of the model
i.e.
Code:
function Add_comment($blog_entry) {
...
...
...
  $this->id = $this->db->insert_id();
  return $return;
} // Add_comment()

Then in your controller you can find the id by
Code:
$this->blog_model->id;

If Add_comment can be used to update as well as insert then you need a bit more logic to determine if this is a new or exiting record, but this should be a good start for you


Messages In This Thread
Routing problem - by El Forum - 01-02-2008, 03:44 PM
Routing problem - by El Forum - 01-02-2008, 04:16 PM
Routing problem - by El Forum - 01-02-2008, 04:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB