Jump to content

php in mysql fetched objects


birdie

Recommended Posts

hi, i have a problem with using a database to store php information within html text. I would like to know whether there is an easier way than treating it like bbcode.

Here is one example..

[code]
$sql = "SELECT * FROM table";
$query = mysql_query($sql);
$object = mysql_fetch_object($query);

echo $object->field;

[/code]

Say this field had something like this in it..

[code]
<html><p>Hello my name is <? echo "Birdie"; ?></p></html>
[/code]

Any way of echo'ing the information so that "hello my name is Birdie" is displayed instead of an exact copy of the example above?

Thanks, i've never figured this out before.
Link to comment
Share on other sites

yes in fact there is 2 easier ways.  You can use php's wide array of file handling functions to create a file and write the html to that file, and read contents from that file when needed.  Like session variables are stored to there own file you can do so with php file handling to store whateveer you want in whatever file type you want, only thing is keep them outside the server, unlessyou don't mind people being able to pull them up just by typing them in the url.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.