[SOLVED] PHP not parsing
Posted: Thu Feb 24, 2005 3:17 pm
I have a site which loads all my pages dynamically from a mysql db. The problem I am having is that the pages that have php in them don't parse. the text and graphics are there - the tables that are supposed to be generated by calling on data in the db display the php code and not the actual data. I've looked at the "eval" function but can't seem to get it to work.
any suggetions? ideas?

any suggetions? ideas?
Code: Select all
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Web Pages</title>
<link href="styles/styles.css" rel="stylesheet" type="text/css">
<?php
// Require the database class
require_once('includes/DbConnector.php');
// Create an object (instance) of the DbConnector
$connector = new DbConnector();
// Execute the query
$result = $connector->query('SELECT name,body FROM webpages WHERE ID = '.$HTTP_GET_VARSї'id']);
// Get an array containing the resulting record
$row = $connector->fetchArray($result);
//Parse the db web page
$php_code = eval('?>' . $rowї'body'] . ' <?php ');
?>
</head>
<body>
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="352" height="20" bgcolor="003366"><img src="images/Logo.gif"></td>
<td width="448" valign="bottom" bgcolor="003366"></td>
</tr>
<tr valign="bottom">
<td height="15" colspan="2" bgcolor="003366"><div align="left">
<?php
include ('nav.php');
?>
</div></td>
</tr>
<tr>
<td colspan="2" bgcolor="#FFFFFF"><div align="left">
<br><p>
<span class="body">Web Pages </span><br>
</p>
</div></td>
</tr>
<tr valign="top">
<td height="600" colspan="2" bgcolor="#FFFFFF"><div align="left">
<span class="body">Page Name: <?php echo $rowї'name'];?>
<br>
<br>
</span>
//table that is populated by db
<table width="800" border="0" cellpadding="10" cellspacing="0">
<tr>
<td><div align="left" class="body"><?php print stripslashes $php_code;?>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>