> Inside a function, I am reading data from MySQL.  In case any of these calls 
> fail I follow them with something like:
>   or echo "Can't make query to database!";
> The problem is, I want to do more things than just this... and then I want to 
> return out of the function rather than continuing to execute statements.
> However, the following doesn't work... I get a parsing error.. How can it be 
> done?
>   or 
>   {
>     echo "Can't make query to database!";
>     return;
>   }
>   .. other statements ..
> I could have it call another function to do more things, but then how would I 
> have it return out of it's current function when done doing those things?  
> This is a pretty disasterous inability, not recognizing code blocks.

Hi Matthew,

Please check out the manual for details on the ternary operator - then consider that 
vis-a-vis "code blocks".
The 'traditional' alternative using 'code blocks' would be:

$check = databaseFn(...);
if ( $check )
// then clause = successful, proceed with process
// (opt) else clause = failure, note in log/on screen, set indicators as appropriate, 
// use NOT in the condition if makes the code easier to read


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to