Mi consulta es que tengo el siguiente script, en la cual actualizo varios filas dentro de un bucle
Código PHP:
$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]."' ";
}
}
Me manda el siguiente error:
update farma_DB_bodega.farma_TBL_insumo set precio_unitario = '10' + '0', stock = '1000' + '0.000' where id_insumo = '92' update farma_DB_bodega.farma_TBL_insumo set precio_unitario = '20' + '0', stock = '200' + '0.000' where id_insumo = '252' Error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near 'update farma_DB_bodega.farma_TBL_insumo set precio_unitario = '10'
+ '0', stock ' at line 1 Error Nº 1064<br>
de antemano gracias