Hi guys,
I'm a little stuck can anyone possibly help?
I have a template (row'header') for an email stored in a MYSQL table. An example of the data in the 'header' column is:
What I was hoping to achive is to replace "%%NAME%%" with a results from another table:
PHP Code:
// Get the contents of the template from the database
$query = " SELECT * FROM Gift_Voucher_temps WHERE id=$template";
$result = mysql_query($query);
if (!$result) { echo("ERROR: " . mysql_error() . "\n$result\n"); }
while($row=mysql_fetch_array($result))
{
// Get the gift voucher details
$query2 = " SELECT * FROM Gift_Vouchers WHERE id=$voucher_id";
$result2 = mysql_query($query2);
if (!$result2) { echo("ERROR: " . mysql_error() . "\n$result2\n"); }
while($row2=mysql_fetch_array($result2))
{
$newheader = preg_replace ('%%name%%', $row2['name'], $row['header']);
echo $header;
This didnt echo a thing 
Am I going about this the right way?