$sth = $dbh->prepare(q{SELECT oid from items where orderid = ?}) || die $dbh->errstr; $sth->execute($orderid) || die $dbh->errstr; $sth->bind_columns(\$oid); # Binds each column to $oid, through reference my $sth_udt = $dbh->prepare(qq{UPDATE items set price = ? WHERE oid = ?}); while ($sth->fetch) { my $price = param("item_${oid}_price"); $sth_udt->execute($price, $oid); # You could probably just do this, but it didn't work for me...?!?!: # $sth_udt->execute(param("item_${oid}_price"), $oid); }