[eluser]maria clara[/eluser]
[quote author="theprodigy" date="1265630891"]
Code:
function savecompany_details($id)
{
$data[‘company_id’] = $id;
$this->db->insert(‘maint_company’, $data);
return $this->db->insert_id(); // <------ return the insert id (the id created when the record was inserted)
}
but, you are going to have a hard time getting one, with trying to insert a null record (unless every field in your database is set to allow null - other then the id which is auto incremented)[/quote]
i have tried and put the code as you said and i notice something in the console
Quote:Array
(
[company_code] => fdsfsd
[company_name] => fsdfsdf
[id] => _empty
[oper] => add
)
{"id":21} <------------now the value of the id is 21 but it don't post
is it now adding?? i looked at the structure of my db table maint_company and noticed that it doesn't have allowing a null value in every field.