Michdd Posted December 6, 2008 Share Posted December 6, 2008 I have a MySql loop that has an if statement in it, how do I make it so that it will exit the loop when the if statement is true? Link to comment https://forums.phpfreaks.com/topic/135821-loop/ Share on other sites More sharing options...
laPistola Posted December 6, 2008 Share Posted December 6, 2008 show us the code please Link to comment https://forums.phpfreaks.com/topic/135821-loop/#findComment-707907 Share on other sites More sharing options...
premiso Posted December 6, 2008 Share Posted December 6, 2008 If it is a while loop use break; Link to comment https://forums.phpfreaks.com/topic/135821-loop/#findComment-707908 Share on other sites More sharing options...
RichardRotterdam Posted December 6, 2008 Share Posted December 6, 2008 I have a MySql loop that has an if statement in it, how do I make it so that it will exit the loop when the if statement is true? you can use a break in any loop foreach($somearray as $value){ if($something){ break; } } Link to comment https://forums.phpfreaks.com/topic/135821-loop/#findComment-707912 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.