am using PHP and MySQL to make our school intranet Dynamic, however I have a problem if the is embedded PHP code in a database field. My php code is:-
<?
$db = mysql_connect("host", "user", "password");
mysql_select_db("content",$db);
$sql = "SELECT * FROM content WHERE Index='$id'";
$result = mysql_query($sql,$db);
$results = mysql_query($sql,$db);
include "header.php";
include "menu_staff.php";
while ($myrow = mysql_fetch_row($result))
printf("%s\n",$myrow[5]);
echo $myrow[5];
both the above lives seem to do the same thing.
}
?>
The code retrieves the data fine, however the php code in some of the data fields just prints to the screen. Am I forgetting to do something within the above php code?
Thanks in advance,
Paul Doherty
p.s. the PHP in the database field is:-
<? $db = mysql_connect;("lost", "user", "password"); mysql_select_db("content",$db); $sql = 'SELECT DISTINCT Section FROM staff_handbook; $result = mysql_query($sql,$db); while ($myrow = mysql_fetch_row($result)) { printf("%s\n",$myrow[1]); } ?>