Thread: Apostrophe ie '

    #1
  1. No Profile Picture
    rbarsh
    Guest
    Devshed Newbie (0 - 499 posts)
    I hope someone can help.

    when I enter data into my form if there is an
    apostrophe in a word (ie, it's , Bob's)and I submit that form it will not record the data.
    It will if I omit the apostrophe.
    Cn someone please explain why.

    Thanks
  2. #2
  3. No Profile Picture
    bugi
    Guest
    Devshed Newbie (0 - 499 posts)

    I think the problem is within inserting.

    You probably have something like this:

    $insert = mysql_query("insert into mytable values ('$Field1','$Field2','$Field2','$Field3')");

    And when some of those $Field* inholds apostrophe it'll be like this:

    "insert into mytable values ('Bob's'...)

    So i hope you see what's the problem.

    You can fix this by addslashes()-function like this:

    $Field1 = addslashes($Field1);

    and not like:

    addslashes($Field1);


    Hope it helps! Just remember remove those slashes when you are putting it to web.

    ------------------

    .bugi

Similar Threads

  1. Replies: 3
    Last Post: August 1st, 2003, 08:28 AM
  2. Replies: 2
    Last Post: July 31st, 2003, 11:28 PM
  3. apostrophe problem
    By cgraz in forum PHP Development
    Replies: 5
    Last Post: November 9th, 2002, 06:12 PM
  4. apostrophe(')
    By joyce in forum PHP Development
    Replies: 3
    Last Post: March 7th, 2002, 12:35 AM
  5. using apostrophe
    By philwash in forum PHP Development
    Replies: 1
    Last Post: June 14th, 2000, 12:35 AM

IMN logo majestic logo threadwatch logo seochat tools logo