[eluser]Unknown[/eluser]
Hello guys!
I need some help with my code.
I have this code in my model...
The function inserts successfully the "quote" but it's not return the "id" of the inserted quote.
Code:
function add_quote($customer_id, $contact_id, $comments, $payment_type, $delivery_type)
{
$user_id = $this->session->userdata('user_id');
$ahora = date('Y-m-d H:i:s');
$data = array(
'creation_date' => $ahora,
'status_id' => 1,
'user_id' => $user_id,
'customer_id' => $customer_id,
'contact_id' => $contact_id,
'comments' => $comments,
'payment_type' => $payment_type,
'delivery_type' => $delivery_type
);
$add_quote_result = $this->db->insert('quotes', $data);
// Here comes the problem. $add_quote_result returns 1. The quote was inserted successfully but the code below seems not to work.
$this->db->select('id');
$this->db->from('quotes');
$this->db->where($data);
$get_quote_id = $this->db->get();
$quote_id = $get_quote_id->result();
return $quote_id;
}
what i'm doing wrong?
thanks in advance!