birdie Posted August 10, 2006 Share Posted August 10, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/17162-php-in-mysql-fetched-objects/ Share on other sites More sharing options...
Ninjakreborn Posted August 10, 2006 Share Posted August 10, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/17162-php-in-mysql-fetched-objects/#findComment-72640 Share on other sites More sharing options...
birdie Posted August 10, 2006 Author Share Posted August 10, 2006 ok thanks, i'll try that :) Quote Link to comment https://forums.phpfreaks.com/topic/17162-php-in-mysql-fetched-objects/#findComment-72644 Share on other sites More sharing options...
wildteen88 Posted August 10, 2006 Share Posted August 10, 2006 You can use eval to execute PHP code within a string. However be extremely careful when using eval. If a cracker finds out you are using eval, he can put in some nasty PHP code, which could pertentialy delete every file for your website/database!! Quote Link to comment https://forums.phpfreaks.com/topic/17162-php-in-mysql-fetched-objects/#findComment-72650 Share on other sites More sharing options...
birdie Posted August 10, 2006 Author Share Posted August 10, 2006 wow, its a good thing php code cannot be inserted into my database then.. Quote Link to comment https://forums.phpfreaks.com/topic/17162-php-in-mysql-fetched-objects/#findComment-72740 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.