I know this is a stupid question, but how can I get the value $mail out of this function?

function Email()
	{
		
		$the_name = $_SESSION[$this->GetLoginSessionVar()];
	
		$profil_query="SELECT * FROM $this->tablename WHERE username='$the_name'";

		$resultate_profil=mysql_query($profil_query);

		$resultat=mysql_fetch_array($resultate_profil);
		
		$mail = $resultat['email'];
	
	}

echo $mail;

Thanks.

using return statement at the end of function

function Email()
	{
		
		$the_name = $_SESSION[$this->GetLoginSessionVar()];
	
		$profil_query="SELECT * FROM $this->tablename WHERE username='$the_name'";

		$resultate_profil=mysql_query($profil_query);

		$resultat=mysql_fetch_array($resultate_profil);
		
		$mail = $resultat['email'];
	 
                return $mail;
	}
$revalue=Email();
echo $retvalue;
commented: useful +4

Ok, I found it, sorry for the non-useful post, but I hope I can help others that want to do this. The answer was:

function Emails($mail)
	{
		
		$the_name = $_SESSION[$this->GetLoginSessionVar()];
	
		$profil_query="SELECT * FROM $this->tablename WHERE username='$the_name'";

		$resultate_profil=mysql_query($profil_query);

		$resultat=mysql_fetch_array($resultate_profil);
		
		$mail = $resultat['email'];
		
		return($mail);
	
	}

echo Emails($mail);