• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
handle error insert database

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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.