Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    200
    Thanks
    27
    Thanked 2 Times in 2 Posts

    Error uploading to database with ' character

    Hello,

    I am using a HTML form which posts values to a php script which then writes these values to a database. However, whenever a user inputs the ' character, it errors and won't allow me to upload the text.

    What can I do to solve this?

    Thank you,

    Nicky
    Last edited by nickyfraggle; 11-16-2006 at 05:03 PM. Reason: typo

  • #2
    New Coder
    Join Date
    May 2005
    Posts
    94
    Thanks
    4
    Thanked 0 Times in 0 Posts
    addslashes() is your friend

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    200
    Thanks
    27
    Thanked 2 Times in 2 Posts
    will this also output it or does it merely use them / to allow it to get into the database?

    also...where would I insert it in my query string?

    thanks for your help!

    nicky

  • #4
    Regular Coder
    Join Date
    Mar 2006
    Posts
    200
    Thanks
    27
    Thanked 2 Times in 2 Posts
    $string = addslashes($string);

    it's ok...i think i've found the answer to part of my own question :-)

  • #5
    New Coder
    Join Date
    Nov 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by nickyfraggle View Post
    $string = addslashes($string);

    it's ok...i think i've found the answer to part of my own question :-)
    If you are using a mySQL database I would take a look at:

    http://www.php.net/manual/en/functio...ape-string.php

    ~UberDragon

  • #6
    Regular Coder
    Join Date
    Oct 2006
    Location
    Bristol
    Posts
    128
    Thanks
    0
    Thanked 0 Times in 0 Posts
    just don't forget to use stripslashes() when u get the data from the database

    Alex


  •  

    Posting Permissions

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