Created
March 19, 2012 01:36
-
-
Save Chavao/2089545 to your computer and use it in GitHub Desktop.
Uma solução que achei para tentar conexão em algum momento de instabilidade, dando até 5 segundos para desafogar e conseguir a conexão.
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 | |
$i = 0; | |
while ($i++ < 5 && !$connected) | |
{ | |
$connected = ($this->_resource = mysql_connect($host, $user, $password, true)); | |
if(!$connected) { | |
sleep(1); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment