Ver Mensaje Individual
  #5 (permalink)  
Antiguo 06/04/2009, 12:29
climax2006
 
Fecha de Ingreso: abril-2006
Mensajes: 240
Antigüedad: 18 años, 1 mes
Puntos: 1
Respuesta: error al actualizar en varias filas dentro de un bucle

ya lo solucione lo colque fuera del bucle while y funko y tb saque la concadenacion

salu2

$puntocoma = explode(";",$_POST["ids"]); //este es un string ej: "a,b,c,d;e,f,g,h" etc
$sql = '';
for($p = 0; $p < count($puntocoma); $p++){
$comaupdate = explode(",",$puntocoma[$p]);
$sqlInsumo = "select precio_unitario, stock from farma_DB_bodega.farma_TBL_insumo where id_insumo = '".$comaupdate[10]."'";
$qryInsumo = $this->AskSQL($sqlInsumo); //$this->AskSQL es igual a mysql_query
while($dataInsumo = mysql_fetch_row($qryInsumo)){
$sql = " update farma_DB_bodega.farma_TBL_insumo set precio_unitario = '".$comaupdate[0]."' + '".$dataInsumo[0]."', stock = '".$comaupdate[1]."' + '".$dataInsumo[1]."' where id_insumo = '".$comaupdate[10]."' ";
}
mysql_query($sql)
}