Jump to content

PHP code within mysql database content


emexinc

Recommended Posts

...is it possible to put php code ( such as a variable ) into a mysql database ( i know this is a yes )...and then be able to pull out that exact code from the database ( i can't get this to work ) and then implement it into a *.*.php file...and then have it conform to whatever that desired variable should be?...i really hope this makes sense as to what i would like to do...thanks for your time...
Link to comment
https://forums.phpfreaks.com/topic/17388-php-code-within-mysql-database-content/
Share on other sites

...sorry...let me explain this...
...i have a database with 3 columns...( TITLE - AUTHOR - LYRICS_AND_CHORDS )...
* EXAMPLE *...my first row has the following information...
...under TITLE - Beautiful Day
...under AUTHOR - U2
...under LYRICS_AND_CHORDS - <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A Bm D G&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; A <br>The heart is a bloom, shoots up through the stony ground.</p>

...now if i put all this and then retrieve all these details and input them into variables on a php page, then everything works...but...if i do the following...

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php $_1.'&nbsp;'.$_2 ?>

...when i retrieve this...<?php $_1.'&nbsp;'.$_2 ?> is written exactly as i had put it in...whereas $_1 and $_2 should of been replaced by given variables and then those variables should of been displayed...

...please tell me this makes some sense...
...i'm making this way too confusing...here it is...i can input php code into a database...such as <?php echo $_1 ?> ...but when I retreive that from the database...it shows up exactly as <?php echo $_1 ?> ...whereas it should of echoed the variable $_1 ( whatever that may be ) ...and that should show up in the source code of that page...but all i see in the source code is <?php echo $_1 ?> ...thanks for continuing to help me with this...

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.