September 13th, 2000, 03:24 AM
-
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?
September 13th, 2000, 07:03 AM
-
quick fix
insert into Table (field) values("d'argent");
September 13th, 2000, 07:54 AM
-
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
September 13th, 2000, 09:17 AM
-
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.
September 13th, 2000, 09:21 AM
-
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 ')
September 13th, 2000, 10:59 AM
-
magic_quotes_gpc=0 to turn it off
September 13th, 2000, 11:08 AM
-
i do not have user rights to change this at my provider
September 13th, 2000, 12:40 PM
-
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.