Re: Exit script early
| From: | 1LT John W. Holmes | Date: | Tue, 16 Jul 2002 19:09:29 +0000 |
| Subject: | Re: Exit script early | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-107953@lists.php.net to get a copy of this message | ||
Why do you need to exit? If your code is layed out correctly, you shouldn't
have to.
if($something)
{ //part 1 }
else
{ //part 2 }
If $something evaluates to true, only Part 1 is executed...part 2 is never
seen. vice versa if $something is negative.
---John Holmes...
----- Original Message -----
From: "Michael Zornek" <mikezornek@mikezornek.com>
To: <php-general@lists.php.net>
Sent: Tuesday, July 16, 2002 1:08 PM
Subject: [PHP] Exit script early
> Ok,
>
> So I'm creating a details.php page where I'm expecting the url to be
> something like:
>
> /details.php?id=12345
>
> Thus in my php I have the following:
>
> if (!isset($id))
> { // if no id exsits
>
> // Create a page saying ID not found, goto index
> writeHTMLTag();
> writeHeader("Error", "never");
> writeBodyTag();
> writeLogoNav();
>
> echo "<h1>Error: A hospital ID was not found.</h1>
> <p>Goto: <a href=\"index.php\">Nursing Career Match</a>
> ";
>
> writeFooter();
> writeHTMLTagCloser();
>
> // what command can I use to end the script right here?
> }
> else
> { // Run MySQL stuff and display page
>
> }
>
> My question is "what command can I use to end the script [inside the top
> part of that if statement]?"
>
> ~ Mike
> --
> Mike Zornek | Project Leader
> Apple Student Developers
> The Insanely Great Site with the Insanely Long URL
> http://www.applestudentdevelopers.org
>
> Personal Site:
> http://www.mikezornek.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>