Jump to content

Archived

This topic is now archived and is closed to further replies.

jasonc

error accessing mysql how do i get it

Recommended Posts

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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.