Mysql Insert Handling For Avoid Dublicate Entry

hi,

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 );


if($transcript->save())

  //everything fine

else

  // retry?



make use of validation

here is very good reference

http://www.yiiframework.com/wiki/56/

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?