#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    37
    Rep Power
    15
    when i put a value in a field: name varchar(20)


    for example d'argent, it will not be returned the same. How can i solve this?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    73
    Rep Power
    15
    quick fix

    insert into Table (field) values("d'argent");
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    37
    Rep Power
    15
    i use facemySQL to insert data into mysql. It is about the same as phpMyadmin, very usefull. But one thing when i insert or update data, this is part of it's code in de forms

    $value[$i]=addslashes($value[$i]);

    It puts in a slash when i insert something like d'argent. it returns : d'argent. Ok, i cut the addslashes part, now it does put it the way i want. But i can imagine that the addslashes part has a meaning, so what i would like is to leave the code as it originally was so when i retrieve data out of mysql i do not want to see d'argent.

    So i think i have to use stripslashes(). So lets say i have a field :naam

    Is this going to work?

    $naam = stripslashes($naam)

    But where do i put this because when i put it in the form where i have the query, it is ignored

    tnx
  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    You shouldn't see the backslash when you remove the record. What you are experiencing is double escaping. You have magic quotes turned on so the value is automatically escaped when it is passed but then the script does it again when addslashes is used. Remove the addslashes or turn off magic quotes.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    37
    Rep Power
    15
    php.ini at my provider caanot change this. which is the one?

    magic_quotes_gpc = 1 ; magic quotes for incoming GET/POST/Cookie data
    magic_quotes_runtime = 0 ; magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
    magic_quotes_sybase = 0 ; Use Sybase-style magic quotes (escape ' with '' instead of ')
  10. #6
  11. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    magic_quotes_gpc=0 to turn it off
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    37
    Rep Power
    15
    i do not have user rights to change this at my provider
  14. #8
  15. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    62
    There are ways to turn on or off any php.ini properties using an .htaccess file for the directory of your script. See http://www.php.net/manual/configuration.php

    The real question, though, is why turn off magic_quotes_gpc, when the way to solve your problem is to also turn on magic_quotes_runtime, which will unescape any quote characters that were escaped during a POST operation. This way, for most dynamic web operations, you don't even have to think about adding or stripping slashes.

Similar Threads

  1. Replies: 1
    Last Post: February 6th, 2004, 06:53 AM
  2. FEB Reseller *SUPER* Special! @ UnitHosting.net!
    By UnitHosting in forum Web Hosting Offers
    Replies: 0
    Last Post: January 30th, 2004, 10:06 PM
  3. Inserting from form to multiple tables
    By barth in forum MySQL Help
    Replies: 0
    Last Post: January 25th, 2004, 10:27 AM
  4. return value from 3 fields into 1 field
    By denali in forum MS SQL Development
    Replies: 1
    Last Post: December 19th, 2003, 08:44 AM
  5. Validating a field with multiple criteria...
    By brotherloco in forum Java Help
    Replies: 0
    Last Post: October 29th, 2003, 08:40 AM

IMN logo majestic logo threadwatch logo seochat tools logo