Jump to content

calling var from inside mysql record set?


piznac

Recommended Posts

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>&nbsp;</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

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 database

then when printing the string

[code]<?php
$replace_pairs = array("LOL" => $i, "LAL" => $j);
echo(strtr($string_from_database, $replace_pairs));
?>[/code]

Or sth

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.