944,152 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 3227
  • PHP RSS
Aug 10th, 2006
0

Need update query--Remove the coma ","

Expand Post »
Hi friends

Thanks for your repaly for all my question..
I need one update query. I have selected the datas are insert with coma ",".

Query
SELECT city
FROM `locations`
WHERE city REGEXP ','

I got the result..
Silver Spring,
Elkins,
PORTLAND,
Baltimore,

I need like this
Silver Spring
Elkins
PORTLAND
Baltimore

I need to remove the "," and restore the values .
Thanks
Vssp
Similar Threads
Reputation Points: 5
Solved Threads: 5
Junior Poster
vssp is offline Offline
197 posts
since Jul 2006
Aug 10th, 2006
0

Re: Need update query--Remove the coma ","

That's really more of an SQL thing. You may want to try posting there if you don't find your answer here.

It can be done in PHP, probably not as fast, though.
Run your query, parse the result set (Take a look at http://us2.php.net/manual/en/function.stripos.php) and write the update query.
Reputation Points: 23
Solved Threads: 23
Posting Pro in Training
Puckdropper is offline Offline
494 posts
since Jul 2004
Aug 10th, 2006
0

Re: Need update query--Remove the coma ","

Hi thanks for your replay
This is the update query

UPDATE `locations` SET city = replace( city, ',', '' ) WHERE city LIKE '%,'

I just share with u


Reputation Points: 5
Solved Threads: 5
Junior Poster
vssp is offline Offline
197 posts
since Jul 2006
Aug 16th, 2006
0

Re: Need update query--Remove the coma ","

I THINK YIU CAN USE str_replace
Reputation Points: 11
Solved Threads: 0
Junior Poster
aarya is offline Offline
139 posts
since Sep 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Open the exixting pdf file Using PHP
Next Thread in PHP Forum Timeline: Mailing List Scripts





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC