Kemik Posted July 29, 2007 Share Posted July 29, 2007 Hello all, If I make a database query in one function and return the variable. E.g. <?php $q = "SELECT email FROM ".TBL_USERS." WHERE username = '$username'"; $result = mysql_query($q, $this->connection); $dbarray = mysql_fetch_array($result); $email = $dbarray['email']; return $email; ?> I can then use that variable when calling the function cannot I? E.g. <?php if ($database->getEmail($username)){ $mailer->sendJoin($this->username, $email); return 0; //New user added succesfully } ?> The only problem is, the script isn't sending the $email variable to the $mailer. It sends the username fine, but the $email is blank. I've tried making an echo in the second set of code I showed you and $email is empty. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted July 30, 2007 Share Posted July 30, 2007 Try storing the email in a variale. <?php if ($database->getEmail($username)){ $email = $database->getEmail($username); $mailer->sendJoin($this->username, $email); return 0; //New user added succesfully } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.