Welcome Guest, Not a member yet? Register   Sign In
two database insert operations in one function using $this->db->insert()
#2

[eluser]Cro_Crx[/eluser]
You shouldn't really be using the current object to insert into the database, it would probably be better to use another variable. That way you can use two different ones for the inserts, for example

Code:
$data['subproduct']  = $name;
$data['status'] = 1;
$this->db->insert('subproduct', $data);
$insert_id = $this->db->insert_id();

$other_data['subp_id'] = 2;
$other_data['prd_id'] = $insert_id;
$this->db->insert('product_subproduct', $other_data);

You could use anything else instead of $data and $other_data


Messages In This Thread
two database insert operations in one function using $this->db->insert() - by El Forum - 12-17-2009, 09:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB