Re: eval();
| From: | John Taylor-Johnston | Date: | Mon, 31 Oct 2005 02:51:47 +0000 |
| Subject: | Re: eval(); | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-224859@lists.php.net to get a copy of this message | ||
eval( " ?> $contents <?php " );
However, if eval() is the answer, you're probably asking the wrong question. You should take a hard look at your code and think of a better way to do what you need to do. Back to the drawing board? It is either store my html+embedded code in a mysql record, or in an html file, which means playing with fopen. It's easier to hand tweak in phpmyadmin.Nonetheless, even though your test code worked (thanks!) this doesn't. Sigh. if ($contents = displaynew()) eval( " ?> $contents <?php " ); function displaynew() { $file = basename($_SERVER['PHP_SELF']); require 'connect.inc'; $sql = "SELECT HTML FROM
$db.$table_editor WHERE Filename LIKE '".addslashes($file)."' LIMIT 1;";
if ($myquery = mysql_query($sql) and mysql_num_rows($myquery) > 0) {
$mydata = mysql_fetch_array($myquery, MYSQL_NUM);
return $mydata[0];
}
return false;
}