开发者

How can I replace specific fields of an existing row in php+mysql ?

开发者 https://www.devze.com 2023-04-01 00:24 出处:网络
How can I replace specific fields of an existing row in php+mysql ? Table Field1 Field2 Field3 value1 value2 value3

How can I replace specific fields of an existing row in php+mysql ?

Table
Field1 Field2 Field3
value1 value2 value3

I need to find the row with value1 in the table, and r开发者_运维问答eplace value3 only (leaving value2 as it is).

thanks


You could just do a simple UPDATE statement.

UPDATE Table SET Field3 = 'NewValue' WHERE Field1 = 'value1'


the sql query is like (using UPDATE) :

UPDATE Table SET Field3 = 'mynewvalue' where Field1 = 'Value1'

to run it in php use

mysql_query or mysqli::query()

0

精彩评论

暂无评论...
验证码 换一张
取 消