4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 PHP: continue; in if() statement
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Iyonix
WebHelper
WebHelper


Joined: 12 Nov 2002
Posts: 82
Location: Yarm, England

PostPosted: Mon Feb 16, 2004 9:29 pm (20 years, 2 months ago) Reply with QuoteBack to Top

I want to do this, but PHP doesn't do continue for if statements. Any idea how I canget it to leave the loops?

Code:

//Handle submitted data
if($save=="yes"){

  //Is current password correct
  if(md5($currentpass)!=$userdata[password]){
    debug(md5($currentpass)." != ".$userdata[password]);
    $error="Your current password is not correct";
    continue 2; //This should leave two loops
  }

  //Do two new passwords match
  if($fpass!=$fpass2){
    $error="You entered two different new passwords";
    continue 2;
  }

}


Thanks Smile

________________________________
Iyonix
OfflineView User's ProfileFind all posts by IyonixSend Personal Message
Aquilo
Junior WebHelper
Junior WebHelper


Joined: 18 Feb 2004
Posts: 1

PostPosted: Wed Feb 18, 2004 8:58 am (20 years, 2 months ago) Reply with QuoteBack to Top

continue should be used in a loop

like this will print even numbers
Code:
for($i=0; $i<10; $i++)
{
if ($i%2) continue;
echo $i;
}


for things like
Code:
  if($fpass!=$fpass2){
    $error="You entered two different new passwords";
    continue 2;
  }


I would go with die($error) or echo $error then exit;

hope this helps.
OfflineView User's ProfileFind all posts by AquiloSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.231174 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme