#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    St. Petersburg, Fl. USA
    Posts
    2
    Rep Power
    0
    Greetings,

    How can I allow special characters (such as apostrophes) to be inserted into a varchar field? I am using a form generated by a php script.


    TIA,

    Dave
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Washington, USA
    Posts
    52
    Rep Power
    15
    escape 'em

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    $string = ereg_replace("'", "''", $string);
    $query = "INSERT into tablename VALUES( '$field1, '$field2', '$string', '$field4etc' )";
    [/code]


    ------------------
    <UL TYPE=SQUARE>
    <LI> TD Scripts
    <LI> Script School
    <LI>php-scripts
    </UL>

Similar Threads

  1. Escaping special characters in XML
    By JessJenn in forum PHP Development
    Replies: 1
    Last Post: January 5th, 2004, 05:19 PM
  2. showing special characters in a javascript menu
    By Whip in forum JavaScript Development
    Replies: 9
    Last Post: October 20th, 2003, 02:47 AM
  3. mod_rewrite & special characters - % screws things up! (HELP)
    By hknight in forum Apache Development
    Replies: 1
    Last Post: July 31st, 2003, 12:12 PM
  4. Catching special characters
    By hijinx in forum PHP Development
    Replies: 0
    Last Post: March 1st, 2003, 09:13 PM
  5. Dealing with special characters in forms
    By michaelcaplan in forum HTML Programming
    Replies: 1
    Last Post: January 4th, 2003, 02:37 PM

IMN logo majestic logo threadwatch logo seochat tools logo