
06/03/2012, 09:21
|
 | | | Fecha de Ingreso: octubre-2006 Ubicación: $this->home
Mensajes: 824
Antigüedad: 18 años, 5 meses Puntos: 74 | |
Respuesta: Insertar multiples filas con foreach
Código PHP:
Ver originalmysql_connect("localhost","","") or die("No se pudo conectar a la base de datos"); //SELECCIONAMOS LA BASE DE DATOS CON LA CUAL VAMOS A TRABAJAR CAMBIEN EL VALOR POR LA SUYA foreach($_POST['tag'] as $valor) { $qry = mysql_query("INSERT INTO t_tag_articulo (id_tag, id_articulo) VALUES ('".$valor."', '".$_POST['id_articulo']."')") or die("Query: $qry <br />Error: ".mysql_error()); }
Saludos, |