• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1231
  • Last Modified:

remove quotes from field in mysql db

Hi

I have content in a field in my mysql db which have quotes i.e :

'MY CONTENT'

I need an sql that will remove these quotes.
0
ost87
Asked:
ost87
  • 6
  • 5
1 Solution
 
hieloCommented:
UPDATE tablename SET `fieldname`=REPLACE(`fieldname`,"'","")
0
 
ost87Author Commented:
hi

that didn't remove them
0
 
hieloCommented:
Are you sure you supplied the correct value for tableName and filedname? From where are you submitting the query?
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
ost87Author Commented:
perhaps I should give you the background.

I have imported some urls into a database.

when these urls are clicked, I get an error in the browser becuase link is incorrect. This what I get:
/\"http://www.mydomain.com/\

So, I need to remove the stuff around the url (perhaps it isn't quotation?)

really appreciate your help
0
 
hieloCommented:
My first example was to remove single quotes since you posted this:
'MY CONTENT'

From your last post, it seems you need to remove double quotes
UPDATE tablename SET `fieldname`=REPLACE(`fieldname`,'"',"")
0
 
ost87Author Commented:
hi
tested but didn't work
0
 
hieloCommented:
How are you retrieving the data? Are you using PHP?
0
 
ost87Author Commented:
yes, php.
0
 
hieloCommented:
It seems the problem is that php puts those slashes automatically when it finds those apostrophes, quotes, among others. When you print the value, you need to call strip_slashes. Ex:
$result = mysql_query($sql);
while( $row = mysql_fetch_assoc($result) )
{
 echo strip_slashes($row['comments']);
}

If you are still having problems, post your code.
0
 
ost87Author Commented:
this problem wasn't a db issue, but problem in program I was using. but thansk for help anyway
0
 
hieloCommented:
You are welcome
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now