Foros del Web » Programando para Internet » PHP »

duda en poder hacer que continue en otro tr en la tabla

Estas en el tema de duda en poder hacer que continue en otro tr en la tabla en el foro de PHP en Foros del Web. hola es que tengo esto <table width="100%" cellspacing="0" cellpadding="4" border="0" id="table40" class="DarkText"> <tr> <?php do { ?> <td width="25%" valign="top" bgcolor="#ffffff" align="center" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#F5F5F5'" style="background: ...
  #1 (permalink)  
Antiguo 09/01/2013, 09:53
 
Fecha de Ingreso: junio-2012
Ubicación: En el Mundo
Mensajes: 759
Antigüedad: 11 años, 10 meses
Puntos: 10
duda en poder hacer que continue en otro tr en la tabla

hola es que tengo esto


<table width="100%" cellspacing="0" cellpadding="4" border="0" id="table40" class="DarkText">
<tr>
<?php do { ?>


<td width="25%" valign="top" bgcolor="#ffffff" align="center" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#F5F5F5'" style="background: none repeat scroll 0% 0% rgb(255, 255, 255);">

<table cellspacing="0" cellpadding="0" bordercolor="#C0C0C0" border="1" bgcolor="#EFEFEF" style="border-collapse: collapse" id="table41">
<tr>
<td><a href="Bad+Taste-493.htm"><img width="100" vspace="2" hspace="2" border="0" style="border: 1px solid #C0C0C0" src="images/film/<?php echo $row_list_movie_center["image"]; ?>"></a></td>
</tr>
</table>
<p style="margin-top: 5px; margin-bottom: 0"> <b><?php echo $row_list_movie_center["title"]; ?></b></p>
<p style="margin-top: 0; margin-bottom: 0">
<a href="movie-type-2.htm"><font color="#800000">
Category</font></a>: <a href="movie-category-14.htm"><font color="#800000">SCI-FI</font></a></p>
<p style="margin-top: 0; margin-bottom: 6px">
# Views: <?php echo $row_list_movie_center["view"]; ?>
</p></td>


<?php } while ($row_list_movie_center = mysql_fetch_assoc($list_movie_center));?>
</tr>
</table>

pero quiero mostrar solo 5 y hay brinque en otro <tr> </tr>

como podria hacer esto posible
  #2 (permalink)  
Antiguo 09/01/2013, 10:11
 
Fecha de Ingreso: junio-2012
Ubicación: En el Mundo
Mensajes: 759
Antigüedad: 11 años, 10 meses
Puntos: 10
Respuesta: duda en poder hacer que continue en otro tr en la tabla

estoy utilizando esto

<?php $i = 0; if ($i%5 == 0) { echo"</tr><tr>"; } $i++; ?>

pero no me sale lo que queiro hacer
  #3 (permalink)  
Antiguo 09/01/2013, 11:50
 
Fecha de Ingreso: junio-2012
Ubicación: En el Mundo
Mensajes: 759
Antigüedad: 11 años, 10 meses
Puntos: 10
Respuesta: duda en poder hacer que continue en otro tr en la tabla

ya creo tenerlo pero sige dandome problema miren la foto



y esto es el codigo

Código PHP:
Ver original
  1. <?php
  2. $list_film = null;
  3. $i = 0;
  4.  while ($row_list_movie_center = mysql_fetch_assoc($list_movie_center)) {
  5.   if ($i == 0) $list_film = "<tr>".$list_film;
  6.   if ($i == $row_list_movie_center_count) $list_film.= "</tr>";
  7. if ($i%5 == 0)
  8.             {
  9.                 $list_film.= "</tr><tr>";
  10.             }
  11.             $list_film.= "<td width=\"25%\" valign=\"top\" bgcolor=\"#ffffff\" align=\"center\" onmouseout=\"this.style.background='#ffffff'\" onmouseover=\"this.style.background='#F5F5F5'\" style=\"background: none repeat scroll 0% 0% rgb(255, 255, 255);\">
  12.                                
  13.                                     <table cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#C0C0C0\" border=\"1\" bgcolor=\"#EFEFEF\" style=\"border-collapse: collapse\" id=\"table41\">
  14.                                         <tr>
  15.                                             <td><a href=\"Bad+Taste-493.htm\"><img width=\"100\" vspace=\"2\" hspace=\"2\" border=\"0\" style=\"border: 1px solid #C0C0C0\" src=\"images/film/".$row_list_movie_center["image"]."\"></a></td>
  16.                                         </tr>
  17.                                     </table>
  18.                                     <p style=\"margin-top: 5px; margin-bottom: 0\"> <b>".$row_list_movie_center["title"]."</b></p>
  19.                                     <p style=\"margin-top: 0; margin-bottom: 0\">
  20.                                     <a href=\"movie-type-2.htm\"><font color=\"#800000\">
  21.                                     Category</font></a>: <a href=\"movie-category-14.htm\"><font color=\"#800000\">SCI-FI</font></a></p>
  22.                                     <p style=\"margin-top: 0; margin-bottom: 6px\">
  23.                                     # Views: ".$row_list_movie_center["view"]."
  24.                                 </p></td>";
  25.              echo $list_film;                  
  26.             $i++;
  27.            
  28. }  ?>
  #4 (permalink)  
Antiguo 09/01/2013, 11:52
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: duda en poder hacer que continue en otro tr en la tabla

Lee esto: http://www.forosdelweb.com/f18/aport...tablas-618528/
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #5 (permalink)  
Antiguo 09/01/2013, 12:22
 
Fecha de Ingreso: junio-2012
Ubicación: En el Mundo
Mensajes: 759
Antigüedad: 11 años, 10 meses
Puntos: 10
Respuesta: duda en poder hacer que continue en otro tr en la tabla

muchas gracias amigo pero tengo esto del aporte que me conseguiste

Código PHP:
Ver original
  1. <?php
  2. $columnas = 5;
  3. $filas = 4; // OK?
  4.  
  5. // luego, para facilitar esto usaremos dos for() anidados
  6.  
  7.  
  8. for ($x = 0; $x < $filas; ++$x)
  9. {
  10.  
  11.   // "vector" X
  12.   echo '<tr>';
  13.  
  14.   for ($y = 0; $y < $columnas; ++$y)
  15.   {
  16.      echo '<td>';
  17.     while ($row_list_movie_center = mysql_fetch_assoc($list_movie_center)) {
  18.     // rutinas....
  19.     echo "<td width=\"25%\" valign=\"top\" bgcolor=\"#ffffff\" align=\"center\" onmouseout=\"this.style.background='#ffffff'\" onmouseover=\"this.style.background='#F5F5F5'\" style=\"background: none repeat scroll 0% 0% rgb(255, 255, 255);\">
  20.                                
  21.                                     <table cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#C0C0C0\" border=\"1\" bgcolor=\"#EFEFEF\" style=\"border-collapse: collapse\" id=\"table41\">
  22.                                         <tr>
  23.                                             <td><a href=\"Bad+Taste-493.htm\"><img width=\"100\" vspace=\"2\" hspace=\"2\" border=\"0\" style=\"border: 1px solid #C0C0C0\" src=\"images/film/".$row_list_movie_center["image"]."\"></a></td>
  24.                                         </tr>
  25.                                     </table>
  26.                                     <p style=\"margin-top: 5px; margin-bottom: 0\"> <b>".$row_list_movie_center["title"]."</b></p>
  27.                                     <p style=\"margin-top: 0; margin-bottom: 0\">
  28.                                     <a href=\"movie-type-2.htm\"><font color=\"#800000\">
  29.                                     Category</font></a>: <a href=\"movie-category-14.htm\"><font color=\"#800000\">SCI-FI</font></a></p>
  30.                                     <p style=\"margin-top: 0; margin-bottom: 6px\">
  31.                                     # Views: ".$row_list_movie_center["view"]."
  32.                                 </p></td>";
  33.    
  34.     }
  35.      echo '</td>';
  36.   }
  37.   // cerramos X
  38.   echo '</tr>';
  39. }
  40. ?>

pero solo muestra y peliculas cuando son 40 peliculas a mostrar
  #6 (permalink)  
Antiguo 09/01/2013, 12:30
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: duda en poder hacer que continue en otro tr en la tabla

Yo cambiaría el while() por un if(), porque así estás ciclando todos tus resultados dentro de una sola celda.
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #7 (permalink)  
Antiguo 09/01/2013, 12:41
 
Fecha de Ingreso: junio-2012
Ubicación: En el Mundo
Mensajes: 759
Antigüedad: 11 años, 10 meses
Puntos: 10
Respuesta: duda en poder hacer que continue en otro tr en la tabla

pero haora con el if si hay una sola pelicula no la muestra cuando muestra es cuando hay mas de 2

Código PHP:
Ver original
  1. <?php
  2. $columnas = 5;
  3. $filas = 4; // OK?
  4.  
  5. // luego, para facilitar esto usaremos dos for() anidados
  6.  
  7.  
  8. for ($x = 0; $x < $filas; ++$x)
  9. {
  10.  
  11.   // "vector" X
  12.   echo '<tr>';
  13.  
  14.   for ($y = 0; $y < $columnas; ++$y)
  15.   {
  16.      echo "<td width=\"25%\" valign=\"top\" bgcolor=\"#ffffff\" align=\"center\" onmouseout=\"this.style.background='#ffffff'\" onmouseover=\"this.style.background='#F5F5F5'\" style=\"background: none repeat scroll 0% 0% rgb(255, 255, 255);\">";
  17.     if ($row_list_movie_center = mysql_fetch_assoc($list_movie_center)) {
  18.     // rutinas....
  19.     echo "<table cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#C0C0C0\" border=\"1\" bgcolor=\"#EFEFEF\" style=\"border-collapse: collapse\" id=\"table41\">
  20.                                         <tr>
  21.                                             <td><a href=\"Bad+Taste-493.htm\"><img width=\"100\" vspace=\"2\" hspace=\"2\" border=\"0\" style=\"border: 1px solid #C0C0C0\" src=\"images/film/".$row_list_movie_center["image"]."\"></a></td>
  22.                                         </tr>
  23.                                     </table>
  24.                                     <p style=\"margin-top: 5px; margin-bottom: 0\"> <b>".$row_list_movie_center["title"]."</b></p>
  25.                                     <p style=\"margin-top: 0; margin-bottom: 0\">
  26.                                     <a href=\"movie-type-2.htm\"><font color=\"#800000\">
  27.                                     Category</font></a>: <a href=\"movie-category-14.htm\"><font color=\"#800000\">SCI-FI</font></a></p>
  28.                                     <p style=\"margin-top: 0; margin-bottom: 6px\">
  29.                                     # Views: ".$row_list_movie_center["view"]."
  30.                                 </p>";
  31.    
  32.     }
  33.      echo '</td>';
  34.   }
  35.   // cerramos X
  36.   echo '</tr>';
  37. }
  38. ?>
  #8 (permalink)  
Antiguo 09/01/2013, 12:53
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: duda en poder hacer que continue en otro tr en la tabla

¿Ese es todo tu código?
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #9 (permalink)  
Antiguo 09/01/2013, 13:06
 
Fecha de Ingreso: junio-2012
Ubicación: En el Mundo
Mensajes: 759
Antigüedad: 11 años, 10 meses
Puntos: 10
Respuesta: duda en poder hacer que continue en otro tr en la tabla

no aqui esta todo el codigo

http://www.mediafire.com/?c2uuuk54v5dl1so

Etiquetas: mysql, poder, tabla
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:32.