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 Link to comment https://forums.phpfreaks.com/topic/7784-error-accessing-mysql-how-do-i-get-it/ 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] Link to comment https://forums.phpfreaks.com/topic/7784-error-accessing-mysql-how-do-i-get-it/#findComment-28390 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.