Ver Mensaje Individual
  #2 (permalink)  
Antiguo 21/11/2012, 12:33
Avatar de DeivisAndres
DeivisAndres
 
Fecha de Ingreso: febrero-2012
Ubicación: Colombia
Mensajes: 305
Antigüedad: 12 años, 2 meses
Puntos: 41
De acuerdo Respuesta: Problema con tabla y row

Veo que cuando realizas el query no le pasas la conexión:

Código Javascript:
Ver original
  1. $result=mysql_query("SELECT SUM(Debe-Haber) as Total FROM Gastos WHERE Proveedor='$u' AND Eliminado='0'", falta_la_conexion);

Mira la manera como lo aria yo:

Código PHP:
Ver original
  1. <?php
  2. include_once "conexionmy.php";
  3.  
  4. $nombre = $_SESSION['NProv'];
  5. $sql3 = mysql_query("SELECT * FROM transaccint WHERE Operador='$nombre' AND Eliminado='0' AND CargaGastos='0' ORDER BY Fecha DESC", falta_la_conexion) or die(mysql_error());
  6. $nfile = "";
  7.  
  8. /*SALDO*/
  9. $result = mysql_query("SELECT SUM(Debe-Haber) as Total FROM Gastos WHERE Proveedor='$u' AND Eliminado='0'", falta_la_conexion) or die(mysql_error());
  10. $total = mysql_fetch_array($result);
  11.  
  12. //setlocale(LC_ALL,'es_AR');
  13. /*function declarau(){
  14.  echo $_POST['id'] = $u;
  15. }*/
  16. ?>
  17. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  18. <html xmlns="http://www.w3.org/1999/xhtml">
  19. <head>
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  21. <title></title>
  22. </head>
  23. <body>
  24. <form action="" method="post" class="login" style="width:890px">
  25.     <caption> Ventas Sin Compras Operador</caption>
  26.     <? echo $nombre; ?>
  27.     <table cellpadding="5" border="0" align="center" bordercolor="#GGGG" cellspacing="0">
  28.         <thead>
  29.             <tr bgcolor="#EFEEEF">
  30.                 <td width="200">Fecha</td>
  31.                 <td width="200" align="left">N File</td>
  32.                 <td width="200" align="left">Cliente</td>
  33.                 <td width="200" align="right">Importe</th>
  34.             </tr>
  35.         </thead>
  36.         <?php        
  37.         while($row = mysql_fetch_array($sql3)){
  38.             echo '<tbody id="titu">';
  39.             echo '  <tr>';
  40.                         $FechaE = explode("-",$row['campo_3']);
  41.                         $Fecha = $FechaE[2]."/".$FechaE[1]."/".$FechaE[0];
  42.             echo '      <td width="200">'.$Fecha.'</td>';
  43.             echo '      <td width="200" align="left">'.$row['campo_0'].'</td>';
  44.                         if ($nfile != $row['campo_0']){
  45.                             $nfile = $row['campo_0'];
  46.                         }
  47.             echo '      <td width="200" align="left">'.$row['campo_4'].'</td>';
  48.             echo '      <td width="200" align="left">'.$row['campo_5'].'</td>';        
  49.             echo "      <td><a href='hola.php?id=$row[campo_0]'>".$nfile."</a></td>";          
  50.             echo '  </tr>';        
  51.         }
  52.         $_SESSION['Nfile'] = $nfile;
  53.         echo $nfile;
  54.             echo '  <tr>';
  55.             echo '      <td colspan="3">Saldo Cuenta:</td>';           
  56.             echo '      <td colspan="2">'.$english_format_number2 = number_format($total['Total'], 2).'</td>';                 
  57.             echo '  </tr>';
  58.             echo '</tbody>';
  59.         ?>
  60.     </table>       
  61. </form>
  62. </body>
  63. </html>