Forums

PHP

This topic is locked

UPDATE table SET column = replace in a webpage

Posted 17 Sep 2010 07:18:38
1
has voted
17 Sep 2010 07:18:38 jajik vontanczy posted:
Hi,
I run a php/mysql application where users often record duplicates of clients.

When they find out they want me to delete one of them but before doing that I need to transfer casenotes associated with that client to the correct one.

That is not the problem.

Casenotes are in a separate table called casenotes. There is a column called ClientID which links it to the table with client information.

I use mysql:

update casenotes set ClientID = replace(ClientID,'6425','6426');

All casenotes with 6425 as ClientID will change it to 6426.

I NEED TO ASSIGN A PERSON WHO CAN DO THIS FROM ADMIN GUI.
THEY WON’T HAVE ACCESS TO MYSQL BUT THEY WILL NEED TO DO THIS FROM THE WEB APPLICATION.

My application is made in Dreamweaver. I tried to do this by creating a form with two fields called SearchString and SearchStringNew. User would enter a value to be replaced into SearchString and a replacing value in SearchStringNew.

I can’t get the code in Recordset working. I tried

SELECT ClientID,
REPLACE(ClientID, SearchString, SearchStringNew)
FROM casenotes

Or

SELECT ClientID
UPDATE casenotes set ClientID = replace (ClientID, ‘SearchString’, ‘SearchStringNew’
FROM casenotes

... and its modifications

But nothing works for me.

I will be grateful for any ideas from any of you’s gurus on how this could be achieved.

Thank you so much.

Replies

Replied 19 Sep 2010 13:32:01
19 Sep 2010 13:32:01 student 101 replied:
Have you tried creating a form with SearchString and SearchStringNew as form-fields?

That way you can have a login page for the user and they access the page that holds the form with duplicates and update as needed?
Replied 21 Sep 2010 08:23:35
21 Sep 2010 08:23:35 jajik vontanczy replied:
QuoteHave you tried creating a form with SearchString and SearchStringNew as form-fields?

That way you can have a login page for the user and they access the page that holds the form with duplicates and update as needed?

Thanks. All users have their logins and only after logging in they access relevant pages. They can update the information individually changing ClientID in every casenote one by one. This is long and tiresome. What I need is multiple update with one click: Searching all casenotes the corresponding ClientID (SearchString) and replacing it with a new one (SearchStringNew). I created a form with SearchString and SearchString new but I don't know how to make the mysql code (update casenotes set ClientID = replace(ClientID,'SearchString','SearchString') work within the Dreamweaver Recordset.



Reply to this topic