Mysql Insert Handling For Avoid Dublicate Entry


how to achieve if mysql insert fail somehow PK is exist

I have currently

$transcript = new Transcripts;

$transcript->ces = $ces; // possible fail

$transcript->formatted = file_get_contents( $dir );


  //everything fine


  // retry?

make use of validation

here is very good reference

I don’t think this is possible. If a save call fails, it fails and nothing is being written to the DB. Or am I missing something here?