Forum Moderators: coopster
We have all our data for the resort guides in a database however i want to edit the file for say Corfu and add a php include to the database in the form of
<?php include();?> however when i do that it just adds <?php include();?> as if it was just text, and does not include the file content if that makes sense.
Kev
But you need to be a bit careful if you have plain HTML mixed with the <?php include ?> statements, then you want to wrap the data in closing and opening php tags. So let's say your existing script does something like this:
$qh = mysql_query('select page_content from pages ...');
$row = mysql_fetch_array($qh);
echo $row['page_content'];
You want to change it to:
$qh = mysql_query('select page_content from pages ...');
$row = mysql_fetch_array($qh);
eval ('?>'.$row['page_content'].'<?php');
(You don't really need the opening <?php tag at the end, but it's good form to put it there).
Just keep in mind that syntax errors inside eval'd code aren't reported, so it's a bit hard to work with. See [php.net...] for more info.
Hope this helps.
This is the php code we have, this needs to amended however i have no idea, how to do that?
<?
$description = ereg_replace("\n","<br>",$destrow[2]);
print("$description");
?>
Please advise how can i amend this to eval the php we want to include.
Kev