Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/04/2016, 21:39
Avatar de aviweb2015
aviweb2015
 
Fecha de Ingreso: abril-2016
Ubicación: venezuela
Mensajes: 215
Antigüedad: 8 años, 1 mes
Puntos: 1
Respuesta: for no deja ingresar dos prudoctos

ya acomode la base de datos y todo fino el problema es este bendito for que me tiene ar.....



Código PHP:
Ver original
  1. <?php
  2. if (isset ($_POST['guardar'])){
  3. $idfactura=$_REQUEST['idfactura'];
  4. $idcedula=$_REQUEST['idcedula'];
  5. $fecha=$_REQUEST['fecha'];
  6. $costetotal=$_REQUEST['costetotal'];
  7. $iddetalle_factura=$_REQUEST['iddetalle_factura'];
  8. $idproductos=$_REQUEST['idproductos'];
  9. $cantprod=$_REQUEST['chk_group3'];
  10. $coste=$_REQUEST['chk_group2'];
  11. $personas=$_REQUEST['personas'];
  12. $evento=$_REQUEST['evento'];
  13. $lugar_evento=$_REQUEST['lugar_evento'];
  14. $dia=$_REQUEST['dia'];
  15. $hora_evento=$_REQUEST['hora_evento'];
  16.  
  17. include("conexion.php");
  18.   $sql="SELECT * FROM factura WHERE idfactura='$idfactura'";
  19.   $res=mysql_query($sql,$link);
  20.   $nrows=mysql_num_rows($res);
  21.   if($nrows==0){
  22.  
  23.  for (int i = 0; i < ftotal; i++) {
  24.  
  25.  
  26. for(x=0;x<filas;x++){
  27.  
  28. }
  29.  
  30.         for($j=0;$j<count($cantprod);$j++){
  31.         for($k=0;$k<count($coste);$k++){
  32.  
  33.  
  34.  
  35. if (mysql_query("INSERT INTO factura (idfactura,idcedula,fecha,costetotal) VALUES
  36. ('$idfactura','$idcedula','$fecha','$costetotal')",$link));
  37.  
  38. if (mysql_query("INSERT INTO detalles_factura (iddetalle_factura,idfactura,idproductos,cantprod,coste,personas,evento,lugar_evento,dia,hora_evento) VALUES
  39. ('$iddetalle_factura','$idfactura','$idproductos','$cantprod[$j]','$coste[$k]','$personas','$evento','$lugar_evento','$dia','$hora_evento')",$link));
  40. }}
  41.  
  42. echo "<script>alert ('Se ha generado el contrato!');</script>
  43. <META HTTP-EQUIV='REFRESH' CONTENT=0;URL=http:presupuesto.php>";
  44.           }
  45.   else echo "<script>alert ('Disculpe este presupuesto ya existe!');</script>
  46. <META HTTP-EQUIV='REFRESH' CONTENT=0;URL=http:presupuesto.php>";
  47. }
  48. ?>

solo me falta eso disculpa tanta molestia
__________________
yoclens avilan