Ver Mensaje Individual
  #11 (permalink)  
Antiguo 08/06/2010, 09:05
Avatar de quike88
quike88
 
Fecha de Ingreso: agosto-2008
Mensajes: 471
Antigüedad: 15 años, 8 meses
Puntos: 87
Respuesta: mostrar en orden por ID (order by id desc limit 1)

podrías hacerlo asi:

Código PHP:
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>

<?php
$connect
=mysql_connect("","","");
mysql_select_db("",$connect);
$sql "SELECT * FROM enlaces order by id desc limit 5";  
$result mysql_query($sql$connect) or die (mysql_error());  
 
while (
$row mysql_fetch_array($result)) { 
    
$nombre[] = $row['nombre']; 
    
$caratula[] = $row['caratula']; 
    
$id[]=$row['id'];

?>
<table align="center">
    <tr>
<?php
for($i=0;$i<count($nombre);$i++)
 echo 
'<td width="135" align="center"><img style="width: 120px; height: 180px;" src="'.$caratula[$i].'" /></td>';
?>
</tr>
    <tr>
<?php
for($i=0;$i<count($nombre);$i++)
 echo 
'<td align="center">'.$nombre[$i].'</td>';
?>
</tr>
    <tr>
      <td colspan="<?php echo count($id); ?>">&nbsp;</td>
</tr>
    <tr>
<?php
for($i=0;$i<count($nombre);$i++)
 echo 
'<td align="center"><a href="enlace.php?ver='.$id[$i].'">Ver Mas</a></td>';
?>
</tr>
</table>
</body>
</html>
pero no es la forma mas optima, lo mejor seria q muestres una fila por cada contenido:

Código PHP:
<?php
$connect
=mysql_connect("","","");
mysql_select_db("",$connect);
$sql "SELECT * FROM enlaces order by id desc limit 1"
$result mysql_query($sql$connect) or die (mysql_error()); 
echo 
'<table align="center">';
while (
$row mysql_fetch_array($result)) { 
echo
'<tr> 
<td><img style="width: 120px; height: 180px;" src="'
.$row['caratula'].'"></td> 
<td>'
.$row['nombre'].'</td> 
<td><a href="enlace.php?ver="'
.$row['id'].'">Ver mas</a></td> 
</tr>'
;  

echo 
'</table>';
?>
ni me di cuenta q movieron el tema jeje, te lo tienen q mover de nuevo a php