Re: Question about the exit() command
| From: | Mike Joseph | Date: | Thu, 19 Dec 2002 22:48:35 +0000 |
| Subject: | Re: Question about the exit() command | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128916@lists.php.net to get a copy of this message | ||
No, for that use a if statement
if($fname == "Select") {
$errormessage = $error;
include( "other.html" );
exit;
} else {
//code
}
A switch works like this
switch($var) {
case 1:
//if $var==1
$thisvar = $something;
break;
case 2:
//if $var==2
$thisvar = $something2;
break;
}
~Mike
On Thursday, December 19, 2002, at 05:34 PM, Beauford.2002 wrote:
Just to make sure I have this right. I have a switch() statement like below. If the case statement is true it should include the page indicated and exit the PHP script without displaying the echo or executing any other code. If the case is false the script should continue as normal. TIA. switch (true) {case ($fname == "Select"): $errormessage = $error; include ("other.html"); exit;} echo "Other Code"; ----- Original Message ----- From: "Philip Olson" <philip@cornado.com> To: "Beauford.2002" <beauford.2002@rogers.com> Cc: "PHP General" <php-general@lists.php.net> Sent: Thursday, December 19, 2002 4:55 PM Subject: Re: [PHP] Question about the exit() commandHow about: if (!$conn = mysql_connect($host, $user, $pass)) {PHPinclude 'static_html.inc'; exit;} print "Welcome, yes the database is connected"; exit ends the script, nothing after its use is executed. Regards, Philip Olson On Thu, 19 Dec 2002, Beauford.2002 wrote:Hi, Could someone clarify this for me. I want to be able to exit out of amet. Itwebpage and return to the calling page if certain conditions are notit.appears using exit() will do this, but I am unclear exactly how to use-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpany info is appreciated. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php