SoapLady
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by SoapLady
-
-
I have a MySQL table with various email messages I want to send out. (Want to do it that way so they can be edited in our Admin area).
Example:
Table: Email
FieldName: Email_content
[color=red]<p>Dear $firstname,</p>
<p>We received a request to send you your login information. It is as follows:</p>
<p>username: <b>$username</b></p>
<p>password: <b>$password</b></p>[/color]
Once I get the data (via SELECT query), I can access it fine, but can't get the variables replaced by the values (which come from $_SESSION array).
This DOES NOT work; the text with $username and $password unreplaced shows up in the email.
[code]<snipped from inside class>
[SELECT QUERY]
$row = mysql_fetch_array($result)
$this->mailText = $row[email_content];
function __construct($firstname, $username, $password)
{
$this->htmlContent = "$this->mailText";
}
// $this->htmlContent is then passed to the email sending function
<end snippet>[/code]
However, if I do the exact same thing but put the TEXT in the function, the variables are replaced and the email is correct:
[code]function __construct($firstname, $username, $password)
{
$this->htmlContent = "<p>Dear $firstname,</p>
<p>We received a request to send you your login information. It is as follows:</p>
<p>username: <b>$username</b></p>
<p>password: <b>$password</b></p>";
}
[/code]
I'm sure there is something fairly simple I need to do, I just can't figure out what it is!
Help would be appreciated.
SoapLady
Getting values into variables in MySQL result field
in PHP Coding Help
Posted
I still get the email with $username in the text, rather than the value assigned in the function.
Any other ideas?
SoapLady