Browsing articles from "September, 2010"
Sep
26

Update multiple rows at once

Simple way to update multiple rows at once.

Form

$i=0;
while(**){



$i++;}

Update

$size = count($_POST['ID']);
$i=0;
while ($i < $size) {
    $ID=$_POST['ID'][$i];
    $name=$_POST['name'][$i];
    $src=$_POST['src'][$i];
	$Update="UPDATE band_myndir SET
		 name='$name'
		,src='$src'
			WHERE ID='$ID'";
$i++;
}