Reply to Re: php/html code stored in mysql

Your name:

Reply:


Posted by J.O. Aho on 03/06/06 06:22

a wrote:
> I've been storing some html data in a mysql database and creating webpages
> based on that code using a simple "echo $html" type command. I have some
> php code sprinked in and noticed that php doesn't execute this code, it just
> prints it. After reading some more about it, i found out you have to use
> eval() to execute a string of php code. My problem is that there is
> html/php code. is there a way to "execute" the html code along /w the php
> code, or somehow seperate it, so only php code gets the eval() function?
>
>

Yes you can, there is two ways

--- code 1 ---
<?PHP
$code="echo \"test\n\"; ?> <h1>hello</h1> <?PHP echo \"test2\n\"; ";

eval($code);

?>
--- eof ---


--- code 2---
<?PHP
$code="echo \"test\n\"; echo \"<h1>hello</h1>\"; echo \"test2\n\"; ";

eval($code);

?>
--- eof ---


//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация