Skip to content

Instantly share code, notes, and snippets.

@jamesBan
Created June 27, 2014 10:37
Show Gist options
  • Select an option

  • Save jamesBan/a84aed8ac4621e9d9d50 to your computer and use it in GitHub Desktop.

Select an option

Save jamesBan/a84aed8ac4621e9d9d50 to your computer and use it in GitHub Desktop.
mysql error code
<?php
do{
$retry = false;
$try_num = 1;
try{
$db->exec('UPDATE table num = num + 1 where id = 1;');
} catch (Exception $e) {
if($e->getMessage() == 'error message' && $try_num < 10) {
$retry = true;
$try_num++;
}
}
} while($retry);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment