Tengo un pequeño problema al respecto.
Tengo una tabla la cual tiene un nombre , duración, precio y comprar. Se me ha pedido que ponga en una celda un orden, tipo 1 2 3 .. etc.
He podido sacar ese orden (en la bd empieza por 0 por lo tanto le sumo uno y listo) pero el problema es que me pone del 1 al 14 todo seguido y ya me estoy volviendo loco intentando hacer que salte pero no puedo no se me ocurre ninguna manera :S !!
A ver si me pueden ayudar, os dejo el código:
Código PHP:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<script>
var texto = new Array()
var swf = new Array()
var cancion = new Array()
var titulo = new Array();
</script>
<?php $num_estilo=0; while($rowcancion=mysql_fetch_assoc($ejecuta_canciones)){
if(($num_estilo%2)==0){
$stilo_fondo='#9E6764';
}else{
$stilo_fondo='#A7726E';
}
$num_estilo++;
?>
<script>
texto[<?php echo $rowcancion['idcancion']; ?>] = '<?php $rowcancion['descripcion']=(eregi_replace("[\n|\r|\n\r]", ' ', $rowcancion['descripcion'])); echo $rowcancion['descripcion']; ?>'
swf[<?php echo $rowcancion['idcancion']; ?>] = '<?php echo $rowcancion['swf']; ?>'
cancion[<?php echo $rowcancion['idcancion']; ?>] = '<?php echo $rowcancion['fragmento']; ?>'
titulo[<?php echo $rowcancion['idcancion']; ?>] = '<?php echo $rowcancion['nombre']; ?>'
</script>
<tr bgcolor="<?php echo $stilo_fondo; ?>">
<?php
$t_song="canciones";
$resultado = mysql_query("SELECT orden FROM $t_song ORDER BY orden ASC" ,$cnn);
while ($registro = mysql_fetch_row($resultado)){
foreach($registro as $clave){
echo "<td width='4%'>",$clave+1,"</td>";
}
}
?>
<td width="43%"><span class="filaCancion" onclick="mostrarcancion('<?php echo $rowcancion['idcancion']; ?>')"><?php echo $rowcancion['nombre']; ?></span></td>
<td width="15%" class="filaIzq"><?php echo $rowcancion['duracion']; ?></td>
<td width="38%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="36%" class="alineacionDerecha"><?php echo $rowcancion['precio']; ?> €</td>
<td width="64%" class="alineacionDerecha" >
<span class="comprarCancion">
<a href="agregar.php?id=<?php echo $rowcancion['idcancion']; ?>" target="icentro">
<img src="img/comprarCancion.png" width="90" height="13" alt="Comprar canción" border="0" />
</a>
</span>
</td>
</tr>
</table>
</td>
</tr>
<?php } ?>
<tr bgcolor="<?php echo $stilo_fondo; ?>"><td colspan="4"> <br /> </td></tr>
</table>
Gracias =) !!
![Adios](http://static.forosdelweb.com/fdwtheme/images/smilies/adios.gif)