piznac Posted September 28, 2006 Share Posted September 28, 2006 Is it possible to have this:[quote]<?php $i = "123";?>//get recordset from DB where this is part of it:recordset results = <table width="188" border="0" cellspacing="0" cellpadding="0"> <tr> <td><?php echo $i ?></td> </tr> <tr> <td> </td> </tr></table>[/quote]This may be a little hard to understand. But inside my database I have some HTML,.. with some PHP statements inside. They are not working at all. Anybody have any insight? Quote Link to comment Share on other sites More sharing options...
acdx Posted September 28, 2006 Share Posted September 28, 2006 No. What happens there is the php code simply gets sent to the visitor's browser instead of being evaluated by the server.You can't do this either:[code]<?phpecho("<?php echo('boo'); ?>");?>[/code] Quote Link to comment Share on other sites More sharing options...
piznac Posted September 28, 2006 Author Share Posted September 28, 2006 ok,.. do you know if I could replace something in the string to make it work or something? Quote Link to comment Share on other sites More sharing options...
acdx Posted September 28, 2006 Share Posted September 28, 2006 You could put in some keyword and replace it with variables when printing.Let's say you put "<p>LOL</p><p>LAL</p>" in the databasethen when printing the string[code]<?php$replace_pairs = array("LOL" => $i, "LAL" => $j);echo(strtr($string_from_database, $replace_pairs));?>[/code]Or sth Quote Link to comment Share on other sites More sharing options...
piznac Posted September 28, 2006 Author Share Posted September 28, 2006 Ok I will have to try that,.. and what is sth? Quote Link to comment Share on other sites More sharing options...
acdx Posted September 28, 2006 Share Posted September 28, 2006 Something 8)Also, see [url=http://php.net/strtr]strtr()[/url] Quote Link to comment Share on other sites More sharing options...
piznac Posted September 28, 2006 Author Share Posted September 28, 2006 that worked great man,.. thanks ;D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.