DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login

How To Stop Script?

By: rekha singh | 02 Aug 2010 12:37 pm

Hi, I am looking for a way to stop a script, kinda.

 
For example:
 
if(strlen($username ) == 0)
 
{ echo "Username is empty! All fields are required!"; }
 
If it echo's "Username is empty! All fields are required!" I want it to stop running, so that no further error messages display in my script, but if it does not echo then I continues running.
 
Is there a way to do this?
 
 

Comments

Hi, you can put an exit() function after your echo;

 
 
So, try this:
 
 
if(strlen($username ) == 0) {
 
 
echo "Username is empty! All fields are required!";
 
 
exit();
 
 
 }
>
 
By: rekha singh | 02 Aug 2010

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move