gladiator83x Posted June 15, 2006 Share Posted June 15, 2006 Hey All,I was just wondering if there was any way that I can terminate my code in php? Is there some sort of break command that will stop the compiler from executing the rest of the code? This is a tidbit of my code:--------------------------------------------------------------------------------------------------------$res=mysql_query("select * from End_Review");if(mysql_num_rows($res)==0) echo "there is no data in table..";else{ for($i=0;$i<mysql_num_rows($res);$i++) { $row=mysql_fetch_assoc($res);// echo $row[topic_title];} if ($title==$row[topic_title]) echo '<FONT COLOR=<"FF0000">"A closing time stamp already exists for this topic. Please observe the cycle.</FONT> ';}[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]mysql_query("INSERT INTO End_Review (id,topic_title, date) VALUES('','$title','$test_date' ) ") or die(mysql_error());[!--colorc--][/span][!--/colorc--]//}-------------------------------------------------------------------------------------------------------I just wanted the code to basically stop if ($title==$row[topic_title]) and not go into the red mysql query section. Could someone please help me? [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] Link to comment https://forums.phpfreaks.com/topic/12036-terminating-code/ Share on other sites More sharing options...
nogray Posted June 15, 2006 Share Posted June 15, 2006 use exist() Link to comment https://forums.phpfreaks.com/topic/12036-terminating-code/#findComment-45763 Share on other sites More sharing options...
trq Posted June 15, 2006 Share Posted June 15, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]use exist()[/quote]That would be exit(). Link to comment https://forums.phpfreaks.com/topic/12036-terminating-code/#findComment-45780 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.