Jump to content

Include In Display


glenelkins

Recommended Posts

Hi

Ok say i am creating a display, a table that has a row for a title and a row for content. This information is taken from a database table. There is an option (set to 1 for yes and 0 for no) to determine if the content is from a PHP file or from the database. so the code might look like:

[code]
$sql = "SELECT * FROM blocks WHERE position='right'";
$result = mysql_query($sql) or die (mysql_error());

while ($blocks = mysql_fetch_array($result)) {
if ($blocks['active'] == '1') {
if ($blocks['file'] == '0') {
$blocks_right .= "
<table border='0' width='100%' align='center'>
<tr>
<td align='center'><b>" . $blocks['title'] . "</b></td>
</tr>
<tr>
<td>" . $blocks['content'] . "</td>
</tr>
<tr><td>&nbsp;</td></tr>
</table>";
}
}
}
[/code]

But what if the $blocks['file'] is set to 1, in the database the filename is in $blocks['filename'], how do i include the PHP code for display within the $blocks_right variable to run the code?
Link to comment
https://forums.phpfreaks.com/topic/26429-include-in-display/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.