Ver Mensaje Individual
  #4 (permalink)  
Antiguo 29/12/2012, 16:03
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: onLoad =setInterval, seguir mostrando los datos recibidos, no refrescar

Cita:
Iniciado por krosty4782 Ver Mensaje
Mi consulta.php es la siguiente:

Código PHP:
Ver original
  1. <?php
  2. header("Cache-Control: no-store, no-cache, must-revalidate");
  3. ?>
  4. <?php
  5.  
  6. //Comprobamos que existe una sesion y tiene la variable conectado, si no, redirige a la pagina principal
  7. if(empty($_SESSION['conectado']))
  8. {
  9.  
  10.    header ("Location: index.php");
  11.    exit;
  12. }
  13.  
  14. function filtrar($variable)
  15. {
  16.     return addcslashes(mysql_real_escape_string($variable),',<>');
  17. }
  18.    
  19. if(empty($_SESSION['id']))
  20. {
  21.  
  22.     $_SESSION['id']='0';
  23. }
  24. else
  25. {  
  26.     $id=$_SESSION['id'];
  27.    
  28.     //Caso de que se acabe de enviar un comando, y estemos a la espera de recibirlo en la BBDD
  29.    
  30.     if($id>0)
  31.     {
  32.    
  33.         $mac=filtrar($_SESSION['mac']);
  34.        
  35.         include "dbconnect.php";
  36.        
  37.         $result=mysql_query("SELECT answer FROM shell_".$mac." WHERE finished=1 AND showed =0 AND id=" . $id) or die(mysql_error());
  38.        
  39.         while($row = mysql_fetch_array($result))
  40.         {      
  41.         $_SESSION['id']=0;
  42.         echo $row["answer"]; // Show answer
  43.         $result=mysql_query("UPDATE shell_" .$mac. " SET showed=1 WHERE id=" . $id); // Update for stop showing in screen
  44.         }
  45.                
  46.         include "dbclose.php";
  47.     }
  48. }
  49.  
  50.  
  51. ?>
No compañero, no queremos ver que hace tu consulta.php, queremos ver que hace tu función Consulta() de javascript

SAludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.