Created
June 27, 2014 10:37
-
-
Save jamesBan/a84aed8ac4621e9d9d50 to your computer and use it in GitHub Desktop.
mysql error code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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