echo php from db
Posted: Sun Oct 10, 2004 5:04 am
Hi Guys,
I have searched the forums but have not found anything related to what i want to do.
Basically the subject says it all. I want to echo ( or 'use' ) php from a database.
I currently have it working fine for html, but when i chuck in some php it seems to fall over.
Ok an example...
So if i chuck some html in strContent in the db it would echo it fine, in html.
example
Now, if i chuck in some PHP in strContent nothing appears to happen.
example, if strContent contained
I used code tags because it's stored as plain text so not really php... but i want it to be displayed as php on my page.
Now i may have missed something really simple here, perhaps a php setting for echo to properly decode and display php with echo ? is there another command to use? I tried print and return... no luck here.
Any help would be much appreciated! Thanks guys
I have searched the forums but have not found anything related to what i want to do.
Basically the subject says it all. I want to echo ( or 'use' ) php from a database.
I currently have it working fine for html, but when i chuck in some php it seems to fall over.
Ok an example...
Code: Select all
while ( $row = mysql_fetch_array($result) ) {
echo $row['strContent'];
}example
Code: Select all
<h1>This is heading 1</h1> // so here, it would decode the html and display "This is heading 1"example, if strContent contained
Code: Select all
<? echo "Hi - this just will not display!"; ?>Now i may have missed something really simple here, perhaps a php setting for echo to properly decode and display php with echo ? is there another command to use? I tried print and return... no luck here.
Any help would be much appreciated! Thanks guys