Welcome Guest, Not a member yet? Register   Sign In
MySQL: Inserting data based on insert_id, in a single query?
#5

[eluser]resolv_25[/eluser]
This is not uncommon situation, need of the last insert ID.
PHP has function to accomplish that, and CI as well.

It can be something like this:

Code:
$values = array('col1' => $val1, 'col2' => $val2);

$this->db->insert($this->products, $values);
$last_id =  $this->db->insert_id();

// insert $last_id into products_categories


Messages In This Thread
MySQL: Inserting data based on insert_id, in a single query? - by El Forum - 05-06-2010, 12:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB