Welcome Guest, Not a member yet? Register   Sign In
how to catch db error
#1

i have insert new row to table in same time  ( 10 users )

my primary key is determined from user input with in 3 groups

Blue
Yellow
Green

if user select Blue ID must be B001, B002
Yellow Y001, Y002


i have check to get last Id using query but sometimes getting error duplicate key
i want to catch db error so i can change ID and try to insert again

    try{
      $result = $this->db->insert($table,$data);
      echo $result;
      print  $result;
    }
    catch(Exception $e)
    {

       echo "Test Error"
        //get new ID

        // Insert data with new ID
    }

but now working
Reply


Messages In This Thread
how to catch db error - by amansusanto - 10-11-2019, 07:33 PM
RE: how to catch db error - by InsiteFX - 10-12-2019, 03:58 AM
RE: how to catch db error - by tp45 - 10-12-2019, 07:44 PM
RE: how to catch db error - by amansusanto - 10-13-2019, 07:26 PM
RE: how to catch db error - by InsiteFX - 10-14-2019, 04:21 AM
RE: how to catch db error - by amansusanto - 10-14-2019, 04:42 AM
RE: how to catch db error - by Chroma - 10-14-2019, 08:26 AM
RE: how to catch db error - by amansusanto - 10-15-2019, 08:28 PM
RE: how to catch db error - by InsiteFX - 10-16-2019, 04:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB