Welcome Guest, Not a member yet? Register   Sign In
Insert auto increment using insert_id
#4

[eluser]SkiOne[/eluser]
Code:
public function insertMore()
{
    $company['companyname'] = $this->input->post('company')


      
    $sales = array('name' => $this->input->post('salesrep'));
      
       $this->db->insert('salesperson', $sales),
       $company['salespersonid'] = $this->db->insert_id()

       $this->db->insert('company', $company),

}

This is sort of how I would do it, plus the line return $results really isn't doing anything

Edit:

However this is not following the MVC design patter, the queries should exist in the model and you should pass the post vars to that function


Messages In This Thread
Insert auto increment using insert_id - by El Forum - 08-11-2012, 07:43 PM
Insert auto increment using insert_id - by El Forum - 08-11-2012, 07:51 PM
Insert auto increment using insert_id - by El Forum - 08-11-2012, 07:59 PM
Insert auto increment using insert_id - by El Forum - 08-11-2012, 08:03 PM
Insert auto increment using insert_id - by El Forum - 08-11-2012, 08:16 PM
Insert auto increment using insert_id - by El Forum - 08-11-2012, 08:17 PM
Insert auto increment using insert_id - by El Forum - 08-11-2012, 08:30 PM
Insert auto increment using insert_id - by El Forum - 08-11-2012, 08:33 PM
Insert auto increment using insert_id - by El Forum - 08-11-2012, 08:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB