我的代码如下:
$sql="update xxx set osid = '$getId' and IP = '$getIp' and encryption = '$getEncryption' where UserName ='$user'";
执行后发现不行,反而把我这些数据全部变空了
更新多个字段用逗号隔开,and和or主要用在where筛选
$sql="update xxx set osid = '$getId' ,IP = '$getIp' ,encryption = '$getEncryption' where UserName ='$user'";
update a set
a = b.a
,b=b.b
,c=b.c
from t a,t b
where (a.条件1) and (b.条件2)
或者
你的就是:
$sql="update xxx set osid = '$getId' ,IP = '$getIp' ,encryption = '$getEncryption' where UserName ='$user'";
UPDATE 表名 SET 列名1=值,列名2=值2,... [WHERE 条件]
Update 表 set 字段1=字段1的值,字段2=字段2的值... Where ... 多个字段之间用逗号隔开