Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2006-08-03, 07:39 AM   #1
CelticTiger
Are you sure this is the Sci-Fi Convention? It's full of nerds!
 
CelticTiger's Avatar
 
Join Date: Feb 2004
Location: Ireland
Posts: 266
Send a message via ICQ to CelticTiger
MySql statement needed

Can someone tell me if there is a MySql statement that will do a search and replace on a database? Or any alternative maybe?
__________________

Submissions Wanted!
CelticTiger is offline   Reply With Quote
Old 2006-08-03, 07:49 AM   #2
porno0net
Aw, Dad, you've done a lot of great things, but you're a very old man, and old people are useless
 
Join Date: Feb 2005
Location: Kuopio, Finland
Posts: 26
Quote:
Originally Posted by CelticTiger
Can someone tell me if there is a MySql statement that will do a search and replace on a database? Or any alternative maybe?

UPDATE links SET niche='Amateur' WHERE niche='Amaateur';

UPDATE links SET niche='Hairy',status='Active' WHERE submitter='xxxx' AND email like 'some_dude%';

I hope this helps
porno0net is offline   Reply With Quote
Old 2006-08-03, 08:40 AM   #3
CelticTiger
Are you sure this is the Sci-Fi Convention? It's full of nerds!
 
CelticTiger's Avatar
 
Join Date: Feb 2004
Location: Ireland
Posts: 266
Send a message via ICQ to CelticTiger
Quote:
Originally Posted by porno0net
UPDATE links SET niche='Amateur' WHERE niche='Amaateur';

UPDATE links SET niche='Hairy',status='Active' WHERE submitter='xxxx' AND email like 'some_dude%';

I hope this helps
Thanks for your help - I'm a dumbass when it comes to this stuff so can you clarify it a little for me? Basically what I want to do is remove all instances of any exclamation marks(!) within any link descriptions.
__________________

Submissions Wanted!
CelticTiger is offline   Reply With Quote
Old 2006-08-03, 10:10 AM   #4
cd34
a.k.a. Sparky
 
cd34's Avatar
 
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
create tablenamebackup select * from tablename;
update tablename set fieldname=replace(fieldname,'!','');

tablenamebackup = whatever you want that signifies that you made a backup
tablename = the table that contains the data you want to change
fieldname = the name of the field that has the data you want to change

if you don't know the name of the table or how the table is laid out:

show tables;
describe tablename;

If you're using phpmyadmin, you should be able to navigate through and get the info from the command above.

note, if you screw up:

delete from tablename;
insert into tablename select * from tablenamebackup;
__________________
SnapReplay.com a different way to share photos - iPhone & Android
cd34 is offline   Reply With Quote
Old 2006-08-03, 11:06 AM   #5
CelticTiger
Are you sure this is the Sci-Fi Convention? It's full of nerds!
 
CelticTiger's Avatar
 
Join Date: Feb 2004
Location: Ireland
Posts: 266
Send a message via ICQ to CelticTiger
Thanks cd34 - that did the biz I still had to call in Chop to point out that my spelling was wrong in the statement which led to me wasting his time and mine |shocking|
__________________

Submissions Wanted!

Last edited by CelticTiger; 2006-08-03 at 11:10 AM..
CelticTiger is offline   Reply With Quote
Reply


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 -4. The time now is 10:26 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc