CodeIgniter Forums
handle error insert database - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: handle error insert database (/thread-25970.html)

handle error insert database - El Forum - 01-02-2010

hi, i have a table whit 3 fields, field 1 and 2 are the primary key.. i make a insert in the database and works fine.

I need know if the data what send the user exits in the database previuly.. but i dont like make before a insert an select...

I think.. if i try insert.. the db tell me what the data exits.. and i dont insert.. (validate the primary)

But i have a problem.. when make the second insert.. show me a error in text!! and cant catch..

any can help me?

$set_fav = array (
        'id_usuario' => $this->session->userdata('id'),
        'id_proceso' => $this->session->userdata('id_proceso'),
        'fecha' => date('Y-m-d'));
            return true; // ok new data
            return false; // fail insert.. doble data for prmary key