MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 13th, 2000, 03:24 AM
pepweb pepweb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 37 pepweb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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?

Reply With Quote
  #2  
Old September 13th, 2000, 07:03 AM
des des is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 73 des User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
quick fix

insert into Table (field) values("d'argent");

Reply With Quote
  #3  
Old September 13th, 2000, 07:54 AM
pepweb pepweb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 37 pepweb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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

Reply With Quote
  #4  
Old September 13th, 2000, 09:17 AM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
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.

Reply With Quote
  #5  
Old September 13th, 2000, 09:21 AM
pepweb pepweb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 37 pepweb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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 ')

Reply With Quote
  #6  
Old September 13th, 2000, 10:59 AM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
magic_quotes_gpc=0 to turn it off

Reply With Quote
  #7  
Old September 13th, 2000, 11:08 AM
pepweb pepweb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 37 pepweb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
i do not have user rights to change this at my provider

Reply With Quote
  #8  
Old September 13th, 2000, 12:40 PM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Pembroke Pines, Florida, USA
Posts: 2,300 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 3 h 12 m 27 sec
Reputation Power: 56
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > field name value with special characters??how?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT