1
PHP / Re:Problema en meter datos en bbdd mediante foreach y while
« en: 04 de Mayo de 2016, 14:11:30 pm »
Sería así, pero el problema lo tienes en otro lado, mira bien:
Código: [Seleccionar]
foreach($_POST['cantidad'] as $cantidad_factura) {
$lanzo_consulta_buscar = mysql_query("SELECT id_factura, numero_factura FROM facturas WHERE numero_factura = '" . $numero_factura . "'");
while($resultado_buscar = mysql_fetch_array($lanzo_consulta_buscar)) {
$id_factura_can = $resultado_buscar['id_factura'];
$numero_factura_can = $resultado_buscar['numero_factura'];
$lanzo_consulta_cantidad = mysql_query("INSERT INTO cantidad (id_cantidad, id_factura_can, numero_factura_can, cantidad_factura) VALUES ('NULL', '" . $id_factura_can . "', '" . $numero_factura_can . "', '" . $cantidad_factura ."')");
}
}