Forum Moderators: coopster
$sql_mail="select * from email where id= '5'";
$result_mail = $db->EXECUTE($sql_mail);
$i_mail = mysql_fetch_array($result_mail);
then if I echo "$i_mail[bodytxt]"; i will get “Hello $first $last”
I can echo the content in the database but I cant seem to have it parsed by php and the email i recieve will contain Hello $first $last. I need the $first to be replaced with mike and $last to be replaced with Daniel so my email should NOT be Hello $first $last instead it should be Hello Mike Daniel.
The MySQL database “emails” contains two fields “id” and “body” as such:
# Table structure for table `emails`
#
CREATE TABLE emails (
id int(3) NOT NULL auto_increment,
body longtext NOT NULL,
PRIMARY KEY (id),
FULLTEXT KEY body (body)
) TYPE=MyISAM;
#
# Dumping data for table `emails`
#
INSERT INTO emails VALUES (1, ' Hello $first $last ');
My php code goes something like this:
<?
include_once “sql_connect.php";
$db = new db;
$connect=$db->CONNECT();
$sql_mail="select * from emails where id= '5'";
$result_mail = $db->EXECUTE($sql_mail);
$i_mail = mysql_fetch_array($result_mail);
$first = "Mike";
$last = "Daniel";
$to = "name@domain.com";
$from = "anothername@domain.com";
$subject = "Testing";
$message = "$email[body]";
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($to, $subject, $message, $headers);
?>
the above code works and I will receive an email with “Hello $first $last”. The result I am trying to achieve is “Hello Mike Daniel”.
I hope my explanation is clear.
Thx :)
eval("\$message = \"$email['body']\;")";
$message = $email['body'];
eval("\$message = \"$message\";");