Results 1 to 3 of 3

Thread: How to insert <text> into a text field

  1. #1
    Join Date
    Aug 2008
    Location
    London
    Posts
    11
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default How to insert <text> into a text field

    I need to insert the following text into mysql db: <text1>.<text2>. When I run a statement insert into table(field1) values ('<text1>.<text2>') the output is .. .. If I run a statement insert into table(field1) values ('<<text1>>.<<text2>>') the output is <><>. The statement insert into table(field1) values ('\<text1\>.\<text2\>') produced .. .. result.
    Please help!!!!!!

  2. #2
    Join Date
    Oct 2006
    Posts
    183
    Thanks
    0
    Thanked 11 Times in 11 Posts

    Default

    insert into table(field1) values ('&lt,text1&gt;.&lt;text2&gt;')

    To convert text in PHP do it like this:

    PHP Code:
    $var1 "hey <b>there</b> <span>ted</span>";
    $var1 htmlentities($var1);
    echo 
    $var1
    That returns:
    hey &lt;b&gt;there&lt;/b&gt; &lt;span&gt;ted&lt;/span&gt;
    However when that is placed in HTML it is parsed, so the display on a web page would be EXACTLY as is is set in $var1, with the errors. It will not parse the HTML unless you decode it.

  3. The Following User Says Thank You to motormichael12 For This Useful Post:

    IRG (09-17-2008)

  4. #3
    Join Date
    Aug 2008
    Location
    London
    Posts
    11
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thanks a lot, it works beautifully.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •