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? Link to comment https://forums.phpfreaks.com/topic/22410-calling-var-from-inside-mysql-record-set/ 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] Link to comment https://forums.phpfreaks.com/topic/22410-calling-var-from-inside-mysql-record-set/#findComment-100423 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? Link to comment https://forums.phpfreaks.com/topic/22410-calling-var-from-inside-mysql-record-set/#findComment-100431 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 Link to comment https://forums.phpfreaks.com/topic/22410-calling-var-from-inside-mysql-record-set/#findComment-100435 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? Link to comment https://forums.phpfreaks.com/topic/22410-calling-var-from-inside-mysql-record-set/#findComment-100440 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] Link to comment https://forums.phpfreaks.com/topic/22410-calling-var-from-inside-mysql-record-set/#findComment-100442 Share on other sites More sharing options...
piznac Posted September 28, 2006 Author Share Posted September 28, 2006 that worked great man,.. thanks ;D Link to comment https://forums.phpfreaks.com/topic/22410-calling-var-from-inside-mysql-record-set/#findComment-100465 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.