Comments on: How to update multiple mysql rows with PHP http://blog.zurka.us/update-multiple-mysql-rows-php/ Just another WordPress weblog Mon, 20 May 2013 11:30:55 +0000 hourly 1 http://wordpress.org/?v=3.6 By: Pete http://blog.zurka.us/update-multiple-mysql-rows-php/comment-page-1/#comment-205 Pete Wed, 01 Apr 2009 13:18:38 +0000 http://blog.zurka.us/?p=563#comment-205 Nice solution, but you could make it a little friendlier by assigning each post to a variable. Does the same thing but makes it easier for checking for mistakes etc, especially for new programmers.

for ($i = 0; $i < count($_POST['name']); $i++)
{
$name = $_POST['name'][$i];
$id = $_POST['id'][$i];

$update = mysql_query(“UPDATE pictures SET name = ‘$name’ WHERE id = ‘$id’”)or die(mysql_error());
}

]]>