Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/10/2010, 12:02
Avatar de mexbale
mexbale
 
Fecha de Ingreso: septiembre-2010
Ubicación: Iztapalapa
Mensajes: 146
Antigüedad: 13 años, 7 meses
Puntos: 1
problemas con insert

hola a todos tengo un problema no me guarda mis dos filas que introduzco
les explico mejor
tengo una pantalla que al darle que números de renglones van ocupar me oculta los demás y nada mas deja el numero que se van a meter pero tengo un problema con el código de insert lo que pasa es que quiero que no se inserte los 20 renglones que es posible llenar pero estoy poniendo un if que si esta vació que no lo inserte pero nada mas me inserta 1 no se por que es el problema
aquí les dejo el código php que estoy utilizando
Código PHP:
Ver original
  1. <?php //SEGUNDA TABLA
  2.  
  3. if(isset($_POST["Guardar"]))
  4. {
  5. $FOLIO = $_POST['FOLIO'] = trim($_POST['FOLIO']);
  6. $S11P0101 = $_POST['S11P0101'] = trim($_POST['S11P0101']);
  7. if (empty($S11P0201)){$S11P0201='NULL';}
  8. $S11P0301 = $_POST['S11P0301'] = trim($_POST['S11P0301']);
  9. if (empty($S11P0401)){$S11P0401='NULL';}
  10. if (empty($S11P0501)){$S11P0501='NULL';}
  11. if (empty($S11P0601)){$S11P0601='NULL';}
  12. $S11P0701 = $_POST['S11P0701'] = trim($_POST['S11P0701']);
  13.  
  14. if(!empty($S11P0101) and !empty($S11P0201) and !empty($S11P0301) and !empty($S11P0401) and !empty($S11P0501) and !empty($S11P0601) and !empty($S11P0701))
  15. {mysql_connect("localhost", "root", "102372211");
  16. mysql_select_db("tabaco_2010");
  17. mysql_query("INSERT INTO tbl_enum_hogar_02 (FOLIO, ID, S11P01, S11P02, S11P03, S11P04, S11P05, S11P06, S11P07) VALUES('$FOLIO', '01', '$S11P0101', $S11P0201, '$S11P0301', $S11P0401, $S11P0501, $S11P0601, '$S11P0701')");};
  18.  
  19. $S11P0102 = $_POST['S11P0102'] = trim($_POST['S11P0102']);
  20. if (empty($S11P0202)){$S11P0202='NULL';}
  21. $S11P0302 = $_POST['S11P0302'] = trim($_POST['S11P0302']);
  22. if (empty($S11P0402)){$S11P0402='NULL';}
  23. if (empty($S11P0502)){$S11P0502='NULL';}
  24. if (empty($S11P0602)){$S11P0602='NULL';}
  25. $S11P0702 = $_POST['S11P0702'] = trim($_POST['S11P0702']);
  26.  
  27. if(!empty($S11P0102) and !empty($S11P0202) and !empty($S11P0302) and !empty($S11P0402) and !empty($S11P0502) and !empty($S11P0602) and !empty($S11P0702))
  28. {mysql_connect("localhost", "root", "102372211");
  29. mysql_select_db("tabaco_2010");
  30. mysql_query("INSERT INTO tbl_enum_hogar_02 (FOLIO, ID, S11P01, S11P02, S11P03, S11P04, S11P05, S11P06, S11P07) VALUES('$FOLIO', '02', '$S11P0102', $S11P0202, '$S11P0302', $S11P0402, $S11P0502, $S11P0602, '$S11P0702')");};
  31. }
  32. ?>

de antemano les doy las gracias
suerte