Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 01-11-2005, 12:47 PM   PM User | #1
alaios
Regular Coder

 
Join Date: Aug 2002
Posts: 421
Thanks: 0
Thanked 0 Times in 0 Posts
alaios is an unknown quantity at this point
strip the quotes...

Hi.. do u know an easy way for stripping some quotes from my database??.

For example "INSPEC IEE"
This is a problem because this kind of entries are entered in my db as
INSERT INTO Publishers VALUES (96,'\"INSPEC/IEE\"','\"INSPEC/IEE\"',' .......

The same problem appears when i also use the php to retrieve them.
How i should remove the quotes from my db?
Thx
alaios is offline   Reply With Quote
Old 01-11-2005, 12:54 PM   PM User | #2
Sayonara
Regular Coder

 
Sayonara's Avatar
 
Join Date: Oct 2004
Location: UK
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Sayonara is an unknown quantity at this point
I am not clear on what you're asking. Do you want to remove the quote characters from data that is stored in the db tables, or strip them out of data that has been retrieved from the db by a script?
__________________
Quote:
Originally Posted by liorean
Just remember that you code for the user, and the user visits you because what you code is good.
Sayonara is offline   Reply With Quote
Old 01-11-2005, 02:39 PM   PM User | #3
Horus Kol
Regular Coder

 
Join Date: Nov 2004
Location: Somewhere over the rainbow
Posts: 208
Thanks: 0
Thanked 0 Times in 0 Posts
Horus Kol is an unknown quantity at this point
php has a function called "stripslashes" which removes the escape characters from a string...

so just run that string from the query result through stripslashes($string), and hey presto, they're away
__________________
Questions are what binds the universe,
Questions lead to answers,
Answers lead to knowledge,
Knowledge leads to wisdom,
Wisdom brings more questions -- Horus Kol, 2004 :)
Horus Kol is offline   Reply With Quote
Old 01-11-2005, 02:42 PM   PM User | #4
Sayonara
Regular Coder

 
Sayonara's Avatar
 
Join Date: Oct 2004
Location: UK
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Sayonara is an unknown quantity at this point
That was my first thought too, but s/he consistently asks how to strip the quotes, not the slashes
__________________
Quote:
Originally Posted by liorean
Just remember that you code for the user, and the user visits you because what you code is good.
Sayonara is offline   Reply With Quote
Old 01-11-2005, 05:50 PM   PM User | #5
alaios
Regular Coder

 
Join Date: Aug 2002
Posts: 421
Thanks: 0
Thanked 0 Times in 0 Posts
alaios is an unknown quantity at this point
thx

thx for your answers... I want to remove the quotes from the database
alaios is offline   Reply With Quote
Old 01-12-2005, 10:51 AM   PM User | #6
Horus Kol
Regular Coder

 
Join Date: Nov 2004
Location: Somewhere over the rainbow
Posts: 208
Thanks: 0
Thanked 0 Times in 0 Posts
Horus Kol is an unknown quantity at this point
i don't know of a mysql command to strip the quote, but you can run a select and then update query and modify the data in php...

use strreplace("\", "", $string) to remove and quotes in a string.
__________________
Questions are what binds the universe,
Questions lead to answers,
Answers lead to knowledge,
Knowledge leads to wisdom,
Wisdom brings more questions -- Horus Kol, 2004 :)
Horus Kol is offline   Reply With Quote
Old 01-12-2005, 12:25 PM   PM User | #7
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf is on a distinguished road
just run:
UPDATE Publishers SET yourcolumn = REPLACE(yourcolumn,'\"','')
__________________
Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html
raf is offline   Reply With Quote
Old 01-12-2005, 12:36 PM   PM User | #8
Horus Kol
Regular Coder

 
Join Date: Nov 2004
Location: Somewhere over the rainbow
Posts: 208
Thanks: 0
Thanked 0 Times in 0 Posts
Horus Kol is an unknown quantity at this point
thanks raf - i learn something again today
__________________
Questions are what binds the universe,
Questions lead to answers,
Answers lead to knowledge,
Knowledge leads to wisdom,
Wisdom brings more questions -- Horus Kol, 2004 :)
Horus Kol is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:48 PM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.