如何在一个查询中设置这3个,这样我就不会反复向我的数据库发送垃圾邮件
mysql_query("UPDATE `pool_worker` SET `total_round_shares`='$total' WHERE `username`='$key'");
mysql_query("UPDATE `pool_worker` SET `total_round_rejects`='$totalRejected' WHERE `username`='$key'");
mysql_query("UPDATE `pool_worker` SET `total_found`='$total' WHERE `username`='$key'");
我试着四处寻找我找不到任何人可以帮助一个MySQL菜鸟吗?
答案 0 :(得分:3)
mysql_query("UPDATE `pool_worker` SET `total_round_shares`='$total', `total_round_rejects`='$totalRejected', `total_found`='$total' WHERE `username`='$key'");
答案 1 :(得分:0)
由于您要更新同一个表格中的数据并且where
条件中的条件相同,因此可以轻松合并它们,因为;
mysql_query("UPDATE `pool_worker`
SET `total_round_shares`='$total',
`total_round_rejects`='$totalRejected',
`total_found`='$total'
WHERE `username`='$key'");