Ver Mensaje Individual
  #29 (permalink)  
Antiguo 02/10/2007, 02:51
mreyesb
 
Fecha de Ingreso: febrero-2007
Mensajes: 70
Antigüedad: 17 años, 2 meses
Puntos: 1
Re: MiniChat con PHP/MySQL/AJAX v2.0

Hola
se me ocurrio la brillante idea de revisar el log de errores de php y tenía el siguiente error:

[28-Sep-2007 05:16:29] PHP Warning: mysql_result() [<a href='function.mysql-result'>function.mysql-result</a>]: Unable to jump to row 0 on MySQL result index 4 in C:\wamp\www\sanandresDef22\alumnos\avisos.php on line 41
[28-Sep-2007 05:16:29] PHP Warning: mysql_result() [<a href='function.mysql-result'>function.mysql-result</a>]: Unable to jump to row 0 on MySQL result index 4 in C:\wamp\www\sanandresDef22\alumnos\avisos.php on line 42
[28-Sep-2007 05:16:29] PHP Warning: mysql_result() [<a href='function.mysql-result'>function.mysql-result</a>]: Unable to jump to row 0 on MySQL result index 4 in C:\wamp\www\sanandresDef22\alumnos\avisos.php on line 43

por algún motivo la función mysql_result no funcionaba en esta parte:

Código PHP:
$id=mysql_result($select,0,"id_aviso");    //linea41
$comentario=mysql_result($select,0,"aviso");   //linea42
$fecha=mysql_result($select,0,"fecha_aviso");    //linea 43 
así que cambie esto que estaba en tu codigo:

Código PHP:
$max="select max(id_aviso) from avisos WHERE nombre_curso = '$curso'"
  
$max=mysql_query($max); 
  
$max=mysql_result($max,0,0); 
  
// 
  
$select="select * from avisos where id_aviso = '$max' limit 1"
  
$select=mysql_query($select); 
  
// 
  
$id=mysql_result($select,0,"id_aviso"); 
  
$comentario=mysql_result($select,0,"aviso"); 
  
$fecha=mysql_result($select,0,"fecha_aviso"); 
POR ESTO OTRO, que, segun yo es lo mismo
Código PHP:
$max="select max(id_aviso) from avisos WHERE nombre_curso = '$curso'";
  
$max=mysql_query($max);
  
$max=mysql_result($max,0,0);
  
//
  
$select="select * from avisos where id_aviso = '$max' limit 1";
  
$select=mysql_query($select);
  
$select=mysql_fetch_array($select);   //agregué esta linea
  //
  
$id=$select['id_aviso'];                        //cambie acá
  
$comentario=$select['aviso'];              //cambie acá
  
$fecha=$select['fecha_aviso'];            //cambie acá
  // 
Bueno ahora el log de errores de php no muestra absolutamente nada cuando corro el programa, ni errores de header, ni ningún otro error, pero sigue sin mostrar los mensajes... como te decía antes, los guarda en la base de datos sin problemas, pero no los muestra.... mañana voy a meterle mano al ajax.. haber si lo consigo arreglar con lo poco que se sobre eso...

disculpa mi ignoracia al respecto pero me salta una duda... yo he hecho algunos cosas con ajax y en esta parte:

Código:
function fajax3()
 {
    var ajax;
    ajax=ajaxFunction03();
    var hashviejo;
    hashviejo=document.getElementById('id_hash').value;
    ajax.onreadystatechange=function()
      {
      if(ajax.readyState==4)
        {
	if(hashviejo!=ajax.responseText && ajax.responseText!='vacio')
	 {
		document.getElementById('id_hash').value=ajax.responseText;
		fajax2();		
	 }        
     }
    }
    ajax.open("GET","avisos.php?Hash=si",true);
    ajax.send(null);
 }
esto:
ajax.open("GET","avisos.php?Hash=si",true);
ajax.send(null);

no debería ir antes de:
document.getElementById('id_hash').value=ajax.resp onseText;
?????????????????
te pregunto por lo que me salto la duda.. en otros que he hecho yo por lo menos ha sido asi...

saludos

Última edición por mreyesb; 02/10/2007 a las 03:01