使用更新查询[关闭]

What could be wrong with this update query?

"UPDATE relationships SET status='4' WHERE user_1= $user_1, user_2= $user_2";
UPDATE relationships SET status='4' WHERE user_1 = :user_1 AND user_2= :user_2

And since you've tagged this as a MySQL question, I would suggest that you should switch to PDO and use prepared statements, because the PHP community has begun process of deprecation for the old ext/mysql extension (which provides mysql_* functions).

Here is a nice link on how to work with PDO.

"UPDATE relationships " .
"SET status = '4' " .
"WHERE user_1 = '" . $user_1 . "' AND user_2 = '" . $user_2 . "'";