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

George Carless kafka at antichri.st
Thu Apr 10 14:29:42 EDT 2003


Erm, use "return" if you want to return a value to the caller.  Is that
what you mean?

Something like $sendemail = call_the_function();

Cheers,
--George

On Thu, 10 Apr 2003, ChangingLINKS.com wrote:

> This may be of some interest to you admin/php programmers out there - insofar
> as trying to reduce the amount of unwanted email on the Internet. I am trying
> to create a filter so that I don't send email to people who don't want it.
> The problem is that IANAP, and I have been beating my head against the wall
> on what seeeeems like a veeeerry simple process.
>
> <?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
>

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list