Foros del Web

Foros del Web (http://www.forosdelweb.com/)
-   Mysql (http://www.forosdelweb.com/f86/)
-   -   Ordenar Descendente por id (http://www.forosdelweb.com/f86/ordenar-descendente-por-id-446747/)

alllebor 30/11/2006 03:15

Ordenar Descendente por id
 
Pues eso me gustaria ordenar un listado que he hecho descendentemente por el campo "id" que es la clave primaria y autoincrementable, el problema que yo pongo en la consulta select * from peliculas ORDER BY id DSC, pero no funciona me da este error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /www/sites/1/iespana.es/a/l/alllebor/site/peli/consultar.php on line 25

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /www/sites/1/iespana.es/a/l/alllebor/site/peli/consultar.php on line 28


Aqui os pongo el codigo

<?php
include("conex.php");
$link=Conectarse();
$result=mysql_query("select * from peliculas ORDER BY id DSC",$link);
?>
</p>

<table border="1" bordercolor="#000000"> <tr><td> <a href="insertar.php">Administrador</a></td></tr></table>
<p>&nbsp;</p>
<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1>
<TR align="center"><TD width="109"><strong>&nbsp;Título</strong></TD>
<TD width="140"><strong>&nbsp;Categoría&nbsp;</strong></TD>
<TD width="112"><strong>&nbsp;Comentario</strong></TD>
<TD width="112"><strong>&nbsp;Imagen</strong></TD>
</TR>
<?php

while($row = mysql_fetch_array($result)) {
printf("<tr align='center'><td>&nbsp;%s</td><td>&nbsp;%s&nbsp;</td><td>&nbsp;%s&nbsp;</td><td>&nbsp;<img src='%s' border='0' width='100' height='100' /></td></tr>", $row["titulo"],$row["categoria"], $row["comentario"], $row["imagen"]);
}
mysql_free_result($result);
mysql_close($link);
?>

Alguien tiene alguna solucion?? Se lo agradeceria mucho

Sandunguero 30/11/2006 03:22

Hola !!

¿Donde tú pones "DSC" no sería "DESC"?

Saludos

alllebor 30/11/2006 04:03

Ok
 
tienes razon no me habia dado cuenta. Muchas gracias!!!!!!

Mithrandir 30/11/2006 15:20

MySQL <> SQL Server

Movido a MySQL


La zona horaria es GMT -6. Ahora son las 12:34.

Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.