Ver Mensaje Individual
  #3 (permalink)  
Antiguo 21/01/2018, 20:11
dairo65
 
Fecha de Ingreso: abril-2011
Mensajes: 168
Antigüedad: 13 años
Puntos: 5
Respuesta: reseteo de datos al mes

gracias por tu amable respuesta.
Aquí te tengo el código anterior por que no he empezado lo que te comento ya que no se como hacerlo.
Código PHP:
Ver original
  1. <?php
  2.  
  3.  
  4.  
  5. include('conexion.php');
  6.  
  7. $query = 'SELECT * FROM info';
  8. $resultado =$conexion->query($query);
  9.  
  10.  
  11. ?>
  12. <!DOCTYPE html>
  13. <html lang="es">
  14. <html>
  15. <head>
  16.    
  17.    
  18.    
  19.    <meta charset="utf-8">
  20.    <meta name="viewport" content="width=device-width, initial-scale=1">
  21.     <!-- CSS  -->
  22.   <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  23.   <link href="../css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
  24.   <link rel="stylesheet" href="../css/mostrar.css" rel="stylesheet" media="screen,projection"/>
  25.  
  26.    
  27. </head>
  28.  
  29. <body>
  30.    <nav class="light-blue lighten-1" role="navigation">
  31.     <div class="titulo">
  32.      
  33.     <div class="nav-wrapper container"><a id="logo-container" href="#" class="brand-logo1">Mis Cuentas</a>
  34.      
  35.       </div>
  36.  
  37.       <ul class="right hide-on-med-and-down">
  38.        
  39.     </ul>
  40.    </div>
  41.   </nav>  
  42. </div>
  43.  
  44.    
  45.  
  46.        
  47.  
  48.         <?php
  49.  
  50.  
  51. echo '<h5 align=center><a href="/app/admin/logout.php">Logout</a></h5>';
  52.  
  53. ?>
  54.  
  55.  
  56.       </div>
  57.      
  58.      
  59. </form>
  60. <table border='1' id="tabla1" >
  61.      
  62.      
  63.           <th>Ingresos</th>
  64.           <th>Egresos</th>
  65.           <th>Comentarios.</th>
  66.           <th>fecha</th>
  67.           <th>Acción</th>
  68.  
  69.   </tr>
  70.         <tbody>
  71.           <?php while($row=$resultado->fetch_assoc()){ ?>
  72.   <tr>
  73.            
  74.             <td><?php echo $row['ingreso'];?></td>
  75.             <td><?php echo $row['egreso'];?></td>
  76.             <td><?php echo $row['comentarios'];?></td>
  77.             <td><?php echo $row['fecha'];?></td>
  78.            <td><a class="waves-effect waves-light btn-large" href="eliminar.php?id=<?php echo $row['id'];?>" onclick="return confirm('deseas elimar al este usuarucho del sistema?');">Eliminar</a></td>
  79.            
  80.          
  81.   </tr>
  82.   </tbody>
  83.  
  84.  
  85.      <?php } ?>
  86.  
  87.  
  88. <br></br>
  89.  
  90.  
  91.  
  92.  
  93. <table class="resultado" border='1' id="tabla2" >
  94.  <?php
  95. $sql = "SELECT SUM(ingreso)  as Total1, SUM(egreso)  as Total2 FROM info ";
  96. $resultado=$conexion->query($sql);
  97. $row=$resultado->fetch_assoc();
  98.  
  99. $Total1 = $row['Total1'];
  100. $Total2 = $row['Total2'];
  101. $resta = $Total1 - $Total2;
  102.  
  103.  
  104. /*echo $resta;
  105.  echo $row['Total'];
  106. echo number_format($row['Total1'], 000, '', '.'); con seperador de miles
  107. */
  108. ?>  
  109.     <th>TOTAL INGRESOS</th>
  110.     <th>TOTAL GASTOS</th>
  111.     <th>BILLETERA</th>
  112.    
  113. <tr>    
  114. <td step="any"><?php echo number_format($row['Total1'], 0, '', '.');;?></td>
  115. <td step="any"><?php echo number_format($row['Total2'], 0, '', '.');?></td>
  116. <td step="any"><?php echo number_format($resta, 0, '', '.');?></td>
  117.  
  118.  
  119. </table>
  120. </table>
  121. <br></br>
  122. <a href="http://www.forosdelweb.com/f18/index2.html" class="waves-effect waves-light btn-large">Entradas</a>
  123.  
  124.  
  125.  
  126. </body>
  127. </html>