Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return Statement 1

Status
Not open for further replies.

Fayeby

Programmer
Sep 16, 2002
7
CH
I have been told that I can use a return statement to return to page from and if statement. But i just keep getting premature end of script headers.

Can anyone offer a solution as I only need the if part of the statement and then I want to get out of it.

Cheers Faye

if ($DBI::err) {
$TABLE_OUTPUT .= &quot;<table border=\&quot;10\&quot; height=\&quot;34\&quot;>\n&quot;;

$TABLE_OUTPUT .= &quot;<TR>\n&quot;;
$TABLE_OUTPUT .= &quot;<TD> ERROR - Unable to create Environment</td>\n&quot;;
$TABLE_OUTPUT .= &quot;</TR>\n&quot;;
$TABLE_OUTPUT .= &quot;</table>\n&quot;;

}
else

{
return ????????????????????????????????????????????????;
}
 
Return is used primarily to return a value to the calling function, not to return to a page. In your case, you only want to show an error when the &quot;if&quot; condition is true, so you don't need the &quot;else&quot; statement.

There's always a better way...
 
Thanks - simple when you know how isn't?

Why do books never tell you the easy stuff!

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top