[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 h1Error: A hospital ID was not found./h1 pGoto: 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
Re: [PHP] Exit script early
exit; =) Adam Voigt [EMAIL PROTECTED] On Tue, 2002-07-16 at 13:08, Michael Zornek wrote: 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 h1Error: A hospital ID was not found./h1 pGoto: 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exit script early
So I'm creating a details.php page where I'm expecting the url to be something like: My question is what command can I use to end the script [inside the top part of that if statement]? Ironically enough, exit(); Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exit script early
RTFM re: Exit and Continue. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Michael Zornek [EMAIL PROTECTED] 07/16/02 01:08PM 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 h1Error: A hospital ID was not found./h1 pGoto: 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exit script early
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 [EMAIL PROTECTED] To: [EMAIL PROTECTED] 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 h1Error: A hospital ID was not found./h1 pGoto: 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php