Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/10/2012, 10:43
JosephGalvezG
 
Fecha de Ingreso: mayo-2012
Mensajes: 13
Antigüedad: 11 años, 10 meses
Puntos: 0
Numero de registros relacionados

Buenos tardes amigos, tengo el siguiente probema, solo me sucede cuando creo una guia de despachos, al momento de depurar con dreamweaver me lo muestra correcto, no se el porque.
Código PHP:
$Sql="select * from factura_venta where estado='cancelada'";
$result=mysql_query($Sql,$link);
$num_registros=mysql_num_rows($result);

 while($row = mysql_fetch_array($result))
  {
      ?>
      <tr> 
          <td height="24"><?php echo $row['n_factura']; ?></td>
          <td><?php echo $row['rut_cliente']; ?></td>
          <td><?php echo $row['fecha_venta']; ?></td>
          <td><?php echo $row["neto"];?></td>
           <td><?php echo $row['iva']; ?></td>
          <td><?php echo $row['total']; ?></td>
           <td><?php echo $row['forma_pago']; ?></td>
          <td><a href="facturas_ver_detalles.php?id=<?php echo $row["n_factura"];?>">ver detalles</a></td>
           <td><a href="javascript:pop(<?php echo $row['n_factura']; ?>)"><?php echo $row['estado']; ?></a></td>
          <?php
          
//consulta sql para comprobar si existen relaciones entre las tablas
          //$id = 0;
          //$num = 0;
          
$id $row["n_factura"];
          
$Sql_interna="select factura_venta.n_factura,guia_despacho.n_factura
          from factura_venta inner join guia_despacho on factura_venta.n_factura=guia_despacho.n_factura where factura_venta.n_factura ='$id'" 
or die (mysql_error());
          
$result_interna=mysql_query($Sql_interna,$link)or die (mysql_error());
          
$num=mysql_num_rows($result_interna);
          
          
          
$row2 mysql_fetch_array($result_interna);
          echo 
$num;
          
//echo $row2["factura_venta.n_factura"];
          
?>
          <?php
          
if ($num <1){
          
?>
          <td><a href="crear_guia_despacho.php?id=<?php echo $row["n_factura"];?>">Generar guia de despacho</a></td>
          <?php
          
}else{
              
?>
          <td>Guia de despachoCreada</td>
          <?php
          
}
          
?>
        </tr>
      <?php
}
mysql_free_result($result);
//nuevo
}
?>