PHP Selecting HTML from the DB and apply changes
<p>With a normal <code>SELECT</code> in the mySQL DB I select the HTML content of the final page.</p>

<p>I am building a way to create pages on the fly ( as any CMS does ) and I am saving the HTML code for each page inside a specific table fo my DB.</p>

<p>The problem is I want the content to be multi-language. But I do not know how to SELECT html code from the DB and before printing it, working on it with PHP.</p>

<p>I know it's hard to understand, this is why I have an example :)</p>

<pre><code>$q='SELECT * FROM pages WHERE Page="'.$page.'"';
 $r=mysql_query($q) or die(mysql_error());
     while($row = mysql_fetch_array($r)) {
      $content = $row['Content'];
       }
 return $content;
}
</code></pre>

<p>The Content of the variable <code>$content</code>, will be something like: </p>

<pre><code>&lt;div id="hello"&gt;{$foo}&lt;/div&gt;
</code></pre>

<p>where <code>{$foo}</code> is in fact a PHP variable and must be run by the PHP code before printing the final HTML.</p>

<p>How can I do that? Also please consider I will have many {$foo} variables into the content, so I must find a way to replace all of them and to make the PHP working on them before printing the final HTML code.</p>

<p>Can you help me? :)</p>
