Page 1 of 1

select records based on field content and replace that conte

Posted: Tue Jun 01, 2010 8:03 am
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 !

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

Posted: Tue Jun 01, 2010 9:30 am
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'

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

Posted: Tue Jun 01, 2010 10:08 am
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]'";