Here's my question in a nutshell...
{ Is there an END or Application.Exit() in PHP? }
Basically, I've created several PHP pages which I want to be able to stop the HTML downstreaming of the file execution if certain criteria is met like if MySQL returns no results for a specified username...
This'll make much more sence of what I'm trying to do:
In visual basic, I'd use:
IF totalNumOfUsersMatchingThisName = 0 then
END
END IF
or
IF totalNumOfUsersMatchingThisName = 0 then
Application.Exit()
END IF
For example:
if ($totalNumOfUsersMatchingThisName == 0){
END;
}
if ($totalNumOfUsersMatchingThisName == 0){
Application.Exit();
}figures... :doh:
After I spend all that time searching php.net list of functions and writing this thread, I find it on php.net called "exit()"
It's pretty sweet too because you can have it echo content too, take this example for instance:
<?
//Assume that for whatever reason you want to stop processing the PHP file:
$aVariable==false;
if ($aVariable == false){
exit(myENDfunction("This php file is halted due to some reason...","ff0000","009999"));
}
function myENDfunction($myENDtext,$myENDfgcolor,$myENDbgcolor){
print "<a style=\"color:$myENDfgcolor;background-color:$myENDbgcolor;\">$myENDtext</a>";
}
?>
<html>
<head>
<title>mytitle</title>
</head>
<body>
Looks like everything's ok
</body>
</html>Another nifty PHP function is the register-shutdown-function (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.register-shutdown-function.php">http://www.php.net/manual/en/function.r ... nction.php</a><!-- m -->) which actually performs what I stated in the example above... Explains things a little better too...
sorry for any confusion...you could also just use
if ($totalNumOfUsersMatchingThisName == 0){
exit;
}
{ Is there an END or Application.Exit() in PHP? }
Basically, I've created several PHP pages which I want to be able to stop the HTML downstreaming of the file execution if certain criteria is met like if MySQL returns no results for a specified username...
This'll make much more sence of what I'm trying to do:
In visual basic, I'd use:
IF totalNumOfUsersMatchingThisName = 0 then
END
END IF
or
IF totalNumOfUsersMatchingThisName = 0 then
Application.Exit()
END IF
For example:
if ($totalNumOfUsersMatchingThisName == 0){
END;
}
if ($totalNumOfUsersMatchingThisName == 0){
Application.Exit();
}figures... :doh:
After I spend all that time searching php.net list of functions and writing this thread, I find it on php.net called "exit()"
It's pretty sweet too because you can have it echo content too, take this example for instance:
<?
//Assume that for whatever reason you want to stop processing the PHP file:
$aVariable==false;
if ($aVariable == false){
exit(myENDfunction("This php file is halted due to some reason...","ff0000","009999"));
}
function myENDfunction($myENDtext,$myENDfgcolor,$myENDbgcolor){
print "<a style=\"color:$myENDfgcolor;background-color:$myENDbgcolor;\">$myENDtext</a>";
}
?>
<html>
<head>
<title>mytitle</title>
</head>
<body>
Looks like everything's ok
</body>
</html>Another nifty PHP function is the register-shutdown-function (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.register-shutdown-function.php">http://www.php.net/manual/en/function.r ... nction.php</a><!-- m -->) which actually performs what I stated in the example above... Explains things a little better too...
sorry for any confusion...you could also just use
if ($totalNumOfUsersMatchingThisName == 0){
exit;
}