Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/02/2013, 23:23
NedFock
 
Fecha de Ingreso: febrero-2010
Mensajes: 107
Antigüedad: 16 años, 7 meses
Puntos: 0
Problema al mostrar resultados mysql

Hola amigos de fdw, estoy aprendiendo php y estoy complicado con un código, no entiendo como ordenarlo para que repita la tabla según cuantos resultados.

El código es este
Código PHP:
<link href="../Stylesheet/general.css" rel="stylesheet" type="text/css">
<?
include('../acceso_db.php');

$sql = mysql_query("SELECT * FROM albums WHERE usuario_id='" . $_SESSION['usuario_id'] . "' order by id DESC") or die(mysql_error());
while (
$row = mysql_fetch_array($sql)) {
                
$id             = $row["id"];
                
$nombre             = $row["nombre"];
                
$imagen             = $row["imagen"];
                
$info             = $row["info"];
?>



<table width="76%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="21%"><div align="center"><img src="{<?=$imagen?>}" width="150" height="150"></div></td>
    <td width="79%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="rotulo"><?=$nombre?></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <? $sql = mysql_query("SELECT * FROM canciones WHERE usuario_id='" . $_SESSION['usuario_id'] . "' AND nombre='" . $nombre . "'") or die(mysql_error());
if (
mysql_num_rows($sql)) { // Comprobamos que exista el registro con la ID ingresada 
                
$row            = mysql_fetch_array($usuarios);
                
$nombre2             = $row["nombre"];
?>
          <tr>
            <td><?=$nombre2?></td>
          </tr>
    <? } ?>
         
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>

<? } ?>

Me muestra un resultado solo. Alguna idea? Mil gracias