Jump to content

error accessing mysql how do i get it


jasonc

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.