0
mysql_query("UPDATE `users` SET `balance` = 0 WHERE `username` = '$uid' AND '$ip'");

我如何让它更新用户名等于 UID 或用户名等于 $ip 的数据库?

谢谢。

4

2 回答 2

0

几乎就像你用英语说的一样;)

mysql_query("UPDATE `users` SET `balance` = 0 WHERE `username` = '$uid' or `username` =  '$ip'");
于 2013-07-07T01:35:21.367 回答
0

一种方法:

UPDATE `users`
  SET `balance` = 0
WHERE `username` IN ('$uid','$ip')

相当于

UPDATE `users`
  SET `balance` = 0
WHERE `username` = '$uid'
   OR `username` = '$ip'
于 2013-07-07T02:19:31.097 回答