select records based on field content and replace that conte

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dirkriemp
Forum Newbie
Posts: 2
Joined: Tue Jun 01, 2010 7:57 am

select records based on field content and replace that conte

Post by dirkriemp »

Hello,

I have a database table "table_name" with colomn "ID" (not the primary key).
I want to change the value for each field that has value "A" into value "B".
I thought I could achieve this with PHP statement
"update table_name set ID='B' WHERE ID='A'
but that does not work.

Can anyone help ?

Thanks in advance !
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: select records based on field content and replace that c

Post by mikosiko »

please post the complete code that you are using....
you are missing a " at the end (if this is the complete sentence that you wrote in your PHP code
dirkriemp wrote: "update table_name set ID='B' WHERE ID='A'
dirkriemp
Forum Newbie
Posts: 2
Joined: Tue Jun 01, 2010 7:57 am

Re: select records based on field content and replace that c

Post by dirkriemp »

Thanks for you reply.
I allready fixed it, one of the variables was empty, so no help is needed anymore.

$query = "update table set ID='$_POST[Value_B]' WHERE ID='$_POST[Value_A]'";
Post Reply