更新具有相同行但不同单元名称的mysql表

how i can update mysql table with php?

example

i have:

$sql = mysql_query("UPDATE table_name SET numbers = 'null' where no = '1'") or die(mysql_error());
$sql = mysql_query("UPDATE table_name SET numbers = 'null' where no = '2'") or die(mysql_error());
$sql = mysql_query("UPDATE table_name SET numbers = 'null' where no = '3'") or die(mysql_error());

i need one mysql request, i try this example but it doesn't work.

$sql = mysql_query("UPDATE table_name SET numbers = 'null' WHERE no IN ('1, 2, 3')") or die(mysql_error());

If you remove the single quotes around your WHERE no IN ('1, 2, 3') it will fix your problem

This is assuming that your no column is an integer column

The solution you have come up with only has one item in the IN, and so would be equivalent to:

UPDATE table_name SET numbers = 'null' WHERE no = '1, 2, 3'

You need to use separate strings for each value, i.e.:

UPDATE table_name SET numbers = 'null' WHERE no IN ('1', '2', '3')