Welcome Guest, Not a member yet? Register   Sign In
some doubts about the coding standard
#2

[eluser]cahva[/eluser]
Yeah, that way there is repetition. You can use $this->input->post in model straight but I would do it differently. In model I would have this:
Code:
function insert_db($data)
{
    if (empty($data))
    {
        return false;
    }
    
    $this->db->insert('product',$data);
    return $this->db->insert_id();
}
That way you can pass any data to your model(eg. if your schema changes) and dont have to repeat code.


Messages In This Thread
some doubts about the coding standard - by El Forum - 07-13-2011, 11:30 PM
some doubts about the coding standard - by El Forum - 07-14-2011, 03:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB