[ale] [OT] need help with 2 simple lines of php

Brian brianb_ale at yahoo.com
Thu Apr 10 14:33:47 EDT 2003


How about having the function return a boolean and do
this instead:
 if (function($sendemail($param)) {
     echo "Sendemail";
 }

Otherwise, you can set $sendmail as a global variable
and have your function return a the new $sendmail
value. You can also pass $sendmail using the pass by
reference operator "&". This way, the function will
affect the variable $sendmail upon return.


> <?php
> connect to database
> select a record
> set variable $res that counts number of rows
> 	if( mysql_num_rows( $res ) > 0 )
> 	{
> 	$set variables for information in columns
> 	include ("file with function that alters records");
> 	call the function
> 		the function sets a variable $sendemail "yes" or
> "no"
> 	{
> 	if( $sendemail == "yes" )
> 	{
> 	echo "$sendemail";
> 	}
>   }
> ?>
> 
> The problem is that no matter what I do in the
> function (which works) the 
> calling script does NOT recognize the results of the
> function. The calling 
> script can only see the state the database was in
> before calling the 
> function.
> 
> Why?
> 
> Can't a function in another file set a variable that
> is recognized by the 
> calling script? If not, how come the calling script
> does not recognize the 
> update to the database either?
> 
> Can someone help me write the 2 *working* lines that
> will recognize the work 
> of the function?
> (I tried removing the { before the second if and the
> } after the last 
> $sendemail)
> 
> -- 
> Wishing you Happiness, Joy and Laughter,
> Drew Brown
> http://www.ChangingLINKS.com
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list