Foros del Web » Programando para Internet » PHP »

Que Está Mal?

Estas en el tema de Que Está Mal? en el foro de PHP en Foros del Web. Código PHP:                                          <?php                                            $selectnews  =  mysql_query ( "SELECT TOP 5 * FROM Noticias ORDER BY IDNoticia DESC" ); ?>                                            <?php  while ( $b  =  mysql_fetch_array ( $selectnews )) {  ?>       <tr>         <td width="6%" height="30" bgcolor="#FFFFFF"><div align="center"> <?php $validar  =  ...
  #1 (permalink)  
Antiguo 10/08/2010, 20:16
 
Fecha de Ingreso: abril-2010
Ubicación: Ping: BSAS - Arg
Mensajes: 791
Antigüedad: 14 años
Puntos: 25
Que Está Mal?

Código PHP:

                                        <?php 
                                          $selectnews 
mysql_query("SELECT TOP 5 * FROM Noticias ORDER BY IDNoticia DESC");?>
                                          <?php while ($b mysql_fetch_array($selectnews)) { ?>
      <tr>

        <td width="6%" height="30" bgcolor="#FFFFFF"><div align="center"><?php $validar $b['Link'];if ($validar == ''){echo '';}else{echo '<a href="'.$b['Link'].'"><img src="imagenes/bodypage/chaticon.png" width="30" height="30" border="0" />';}?></a></div></td>
        <td width="17%" bgcolor="#FFFFFF"><div align="center" class="Estilo14"><?php echo $b['Fecha'];?></div></td>
        <td width="77%" bgcolor="#FFFFFF"><div align="center"><span class="Estilo14"><?php echo $b['Noticia'];?></span></div></td>
      </tr>
                                          <?php
                                          
}
                                          
?>

En MSSQL funcionaba perfecto, pero en MYSQL me sale este error:

Cita:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /dir/sp.php on line 546
¿De que puede Ser?
Tengo otras querry que andan de 10, solamente me falla esta.

Gracias desde ya.
  #2 (permalink)  
Antiguo 10/08/2010, 20:23
rpv
 
Fecha de Ingreso: febrero-2010
Mensajes: 275
Antigüedad: 14 años, 2 meses
Puntos: 10
Respuesta: Que Está Mal?

si lo que quieres es extraer los últimos 5 registros se hace:

Código SQL:
Ver original
  1. SELECT * FROM Noticias ORDER BY IDNoticia DESC LIMIT 5
  #3 (permalink)  
Antiguo 10/08/2010, 20:58
 
Fecha de Ingreso: abril-2010
Ubicación: Ping: BSAS - Arg
Mensajes: 791
Antigüedad: 14 años
Puntos: 25
Respuesta: Que Está Mal?

Genio, gracias ;)

Me saco el sombrero:



Etiquetas: mal
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:50.