Is this possible.

Discussion in 'Databases' started by jfontestad, Nov 6, 2007.

  1. #1
    This is what i need.
    Let me know if I'm out of my mind or what.

    I have a table with a field called 'codes'.

    The codes field is displayed on my webpage through php:
    <? echo $row['codes']; ?>
    PHP:
    What I need though is to be able to add text to that 'codes' field from another field call 'bg'.

    Example:

    This would be an example of a data entry in my 'codes' field:

    ...blah blah <? echo $row['bg']; ?> blah blah ....

    Is that possible, do you get what i'm saying?

    Like I need that bg field to be called and placed into that spot in the codes field when that record is called upon.
     
    jfontestad, Nov 6, 2007 IP
  2. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    You can use eval() for that.
    http://www.php.net/eval

    But I really don't like the idea of storing PHP codes in the database like that. Can you separate them to 3 fields instead? Like, 'codeBeforeBg', 'bg', 'codeAfterBg'?
     
    phper, Nov 6, 2007 IP