Currently I have a website that contains one php page and based on what the user selects from the pull down menu, that is what gets populated on the page from a MySQL database. The code works perfectly unless I need to
PHP Code:
<?php
$value = $_GET['page'];
$connection = mysql_connect(localhost, "ID", "PW");
$db = mysql_select_db("DB") or die( "Couldn't select database");
$sql = "SELECT * FROM site WHERE page_id = '$value'";
$mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);
if ($num_rows == 0){
echo " ";
}
else {
while ($row=mysql_fetch_array($mysql_result)) {
$pagename=$row["pagename"];
$content=$row["content"];
echo "<h1>$pagename</h1>
$content";
}
}
mysql_close($connection);
?>
I want to be able to store another php script in the $content from my database so that it is called when the user selects the page. No matter what I have tried, the php does not work and instead it prints the php code.
Is there anyone that can point me in the right direction please?
