Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/11/2013, 08:29
jospercin
 
Fecha de Ingreso: junio-2008
Ubicación: Guatemla
Mensajes: 31
Antigüedad: 15 años, 10 meses
Puntos: 0
Exclamación Ingreso múltiple mysql

buen día, tengo una consulta, estoy tratando de ingresar varios registro a la vez, este codigo funciona perfectamente y hace el ingreso, pero me sale un error de sintaxis, y la intente solucionarlo pero no lo he logrado asi que paso a ver si alguien de usted me puede ayudar
Código PHP:
<?php
for($i=0;$i<=30;$i++){
$uno $_POST['dato1'][$i];
$dos $_POST['dato2'][$i];
$tres $_POST['dato3'][$i]; 
$conexion=mysql_connect('localhost','root','') ;
mysql_select_db('basededatos',$conexion) ;
   
$consulta "insert into tabla (campo1, campo2, campo3)
VALUES ('$uno','$dos','$tres')"
;
 
$resultado mysql_query($consulta,$conexion) or die (mysql_error());

echo 
"<script>alert('Almacenado');</script>";    
    
header("Location:ingreso2.php");

mysql_close($conexion);}

?>
el error es el siguiente:
Problemas en el select: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 '' at line 1