MySQL Question - Populating a variable inside of stored HTML
Posted: Wed Apr 07, 2010 1:31 pm
Hi,
I have an HTML table stored in a MySQL table. Within the HTML, I want to pass a variable that is pulled out of another table. Here is a section of the content that is stored in the table:
<tr>
<td width="50%" height="21">
<p align="center"><font face="Arial" size="4">$m->business_name</font></td>
</tr>
I call the HTML table from MySQL using the following code:
$result = $db->query("SELECT html FROM offer_layout WHERE id='$id'");
$row = mysql_fetch_array($result);
$html = $row['html'];
To get the HTML table onto the web page, I do the following:
$mainContent = <<<EOD
$html
EOD;
Here is the problem - When the HTML table gets displayed, instead of seeing the business name and other business variables in the table, all I see are the variable names, such as "$m->business_name". How do I get the actual variable passed here?
I am storing the HTML table in a database table, as I have 4 different layouts that are used to either display on the web page, or to create the HTML table in an email that gets sent out.
Any advice?
- Joe
I have an HTML table stored in a MySQL table. Within the HTML, I want to pass a variable that is pulled out of another table. Here is a section of the content that is stored in the table:
<tr>
<td width="50%" height="21">
<p align="center"><font face="Arial" size="4">$m->business_name</font></td>
</tr>
I call the HTML table from MySQL using the following code:
$result = $db->query("SELECT html FROM offer_layout WHERE id='$id'");
$row = mysql_fetch_array($result);
$html = $row['html'];
To get the HTML table onto the web page, I do the following:
$mainContent = <<<EOD
$html
EOD;
Here is the problem - When the HTML table gets displayed, instead of seeing the business name and other business variables in the table, all I see are the variable names, such as "$m->business_name". How do I get the actual variable passed here?
I am storing the HTML table in a database table, as I have 4 different layouts that are used to either display on the web page, or to create the HTML table in an email that gets sent out.
Any advice?
- Joe