Jump to content

Using PHP in a mySql table field?


paddy_irl

Recommended Posts

I'm calling text from an mysql database which includes php. I have php echoing values in the database entry for concatenation purposes but when I write it to a page it just writes out the php code in the page source and the browser ignores it.

Can I actually put php in a text field in mysql, do I have to format it or change the field type or how should I be approaching this?

 

database entry:

some text and <?php echo $value ?> more text

 

php calling the text from the database:

$SQL = "SELECT overview_content FROM   overview u
              WHERE  u.ov_id = '$ov_type'  
    " ;
    
$u = @mysql_query($SQL) or die("Couldn't execute query @mysql_query($SQL).");
    
$row =@mysql_fetch_array($u) ;
        
$the_overview = $row['overview_content'];

 

code is working fine and writing out the correct values, the php within the database entry is just being ignored

 

any help is much appreciated!

Link to comment
https://forums.phpfreaks.com/topic/47891-using-php-in-a-mysql-table-field/
Share on other sites

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.