You can't update two tuples with different values. You will have to do one UPDATE
for each tuple or do a bulk insert using the ON DUPLICATE KEY UPDATE
-syntax. See the MySQL reference.
Have a form with inputs that have []
as suffix to their names. This way you can access these inputs as an array in PHP:
$result = mysql_query("SELECT * FROM table");
while ($tuple = mysql_fetch_assoc($result))
{
echo '<input type="text" name="name['.(int)$tuple["id"].']" value="'.htmlentities($tuple["name"]).'" />';
// echo more inputs ...
}
Your post processing code could look like this
foreach ($_POST["name"] as $id => $data)
{
// todo: check if all $_POST columns are set, before accessing them
// if (!isset($_POST["data"][$id], $_POST["murdata"][$id], ...)
// continue;
$query = "UPDATE table SET ".
$query .= "name = ".mysql_real_escape_string($_POST["name"][$id])."'";
// the other columns...
$query .= "WHERE id = '".(int)$id."'";
}