Jump to content


error accessing mysql how do i get it

  • Please log in to reply
1 reply to this topic

#1 jasonc

  • Members
  • PipPipPip
  • Advanced Member
  • 841 posts

Posted 18 April 2006 - 10:15 PM

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

#2 Caesar

  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 18 April 2006 - 11:08 PM

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?


$doit = header("Location: connect.php");

@mysql_connect ($host, $dbusr, $dbpass) or die($doit);

PHP Ninja

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users