Hi,
I have this script which calls html codes from a database:
PHP Code:
$sql = "SELECT * FROM `plugin_frontpage`";
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_object($result))
{
$pf_content = $row->pf_content;
}
The above is stored in a file called plugins.php. Now, theres only one row in that table, and it contains the following html code:
HTML Code:
<html>
<head>
<title>En Testsida</title>
</head>
<body><h1>En Testsida</h1><hr>
Nyheter:<br />
<br />
<b>$pfn_title</b><br />
$pfn_content<br />
<br />
</body>
</html>
As you see, there are 2 variables in that html code, and they come from the following mysql query, which is placed in the same file as the first query, i should also add that its placed above the first query:
PHP Code:
$sql = "SELECT * FROM `plugin_frontpage_news` ORDER BY `pfn_id` DESC";
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_object($result))
{
$pfn_title = $row->pfn_title;
$pfn_content = $row->pfn_content;
}
plugins.php is called by a file called index.php and the variable "$pf_content" is being printed there.
Now to the problem: The two variables that are stored in the plugin_frontpage table wont be replaced with the content in the plugin_frontpage_news table. The html codes work just fine, but the varibles are just being printed as they are, not with its content. What am I doing wrong? I know its possible, vBulletin works the same way. All templates contains variables.
Thanks in advance!
Niklas