jasonc Posted April 18, 2006 Share Posted April 18, 2006 if i get an error accessing mysql how can i re run that part of the script until it can, or until it has let say re runned 5 or so times then shows the error?I think what I am asking is something along the lines of this.forgive the bad syntax but i hope you get the idea.while(no error accessing mysql) {....try to get data....}thank you Quote Link to comment Share on other sites More sharing options...
Caesar Posted April 18, 2006 Share Posted April 18, 2006 Why would you want to keep trying to connect? I'd say if it isn't connecting after 5 attempts, you have bigger issues to deal with, and shouldn't be trying to write your code around it....and to asnwer your question, wouldn't it be easier to do a redirect and reload the script again?[code] $doit = header("Location: connect.php");@mysql_connect ($host, $dbusr, $dbpass) or die($doit);[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.