CodeIgniter Forums
Problem with insert - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problem with insert (/showthread.php?tid=9653)



Problem with insert - El Forum - 07-03-2008

[eluser]Unknown[/eluser]
I have a problem with this insert funcion

function inserirCategoria($id_pare,$nom,$actiu,$ordre) {
$nou_ordre=$ordre+1;

$categoria = array ('nom' => $nom,
'id_pare' => $id_pare,
'actiu' => $actiu,
'ordre' => $nou_ordre);

$this->db->insert('categories', $categoria);

return $this->db->insert_id();

}

In database 'id_pare' is an integer and the function always insert 0,but $id_pare have the correct value.What´s the problem?Because reading codeigniter user guide I think the array is correctly made


Problem with insert - El Forum - 07-03-2008

[eluser]Andreas Krohn[/eluser]
What does your database table look like?


Problem with insert - El Forum - 07-03-2008

[eluser]Unknown[/eluser]
I have found the solution,thank you