Ver Mensaje Individual
  #5 (permalink)  
Antiguo 21/03/2014, 01:55
Avatar de Donmoha
Donmoha
 
Fecha de Ingreso: marzo-2014
Ubicación: Vic
Mensajes: 5
Antigüedad: 10 años, 1 mes
Puntos: 0
Respuesta: Nesesito mostrar en 2 tablas 2 consultas

Código HTML:
Ver original
  1. [HIGHLIGHT="PHP"]<?php
  2.  
  3. include '_config/config1.php';
  4.  
  5. if(isset($_GET['pagina']))
  6. {
  7. $page= $_GET['pagina'];
  8. }
  9. else
  10. {
  11.  
  12. $page=1;
  13. }
  14.  
  15. $consulta = "SELECT * FROM x_contenido_web ORDER BY `x_id` DESC";
  16. $consulta1 = "SELECT * FROM x_contenido_web WHERE mod(x_id,2) = 0 ORDER BY `x_id` DESC LIMIT 0,3";
  17. $consulta2 = "SELECT * FROM x_contenido_web WHERE mod(x_id,2)<> 0 ORDER BY `x_id` DESC LIMIT 0,3";
  18. $datos=mysql_query($consulta,$CON);
  19. $datos1=mysql_query($consulta1,$CON);
  20. $datos2=mysql_query($consulta2,$CON);
  21.  
  22. $num_rows=mysql_num_rows($datos);
  23. $rows_per_page= 6;
  24. $lastpage= ceil($num_rows / $rows_per_page);
  25. $page=(int)$page;
  26.  
  27. if($page > $lastpage)
  28. {
  29. $page= $lastpage;
  30. }
  31.  
  32. if($page < 1)
  33. {
  34. $page=1;
  35. }
  36.  
  37. $limit= 'LIMIT '. ($page -1) * $rows_per_page . ',' .$rows_per_page;
  38.  
  39. $consulta .=" $limit";
  40. $post=mysql_query($consulta,$CON);
  41.  
  42. if(!$post)
  43. {
  44. die('Invalid query: ' . mysql_error());
  45. }
  46. else
  47. {
  48.  
  49. ?>
  50.  
  51. <table width="961" height="710">
  52. <tr>
  53. <td height="645">
  54.  
  55. <table width="40%" border="0">
  56. <tr>
  57. <td width="43%" height="283" align="right">
  58. <table border="0" cellpadding="0" cellspacing="0">
  59. <?php do { ?>
  60. <tr>
  61. <td>
  62.  
  63. <table width="100%" border="0" align="center">
  64. <tr>
  65. <td align=left ><a href="post.php?pagina=0&id=<?php echo $datos22['x_id']; ?>"><img src="<?php echo $datos22['x_imagen_article']; ?>" width="310" height="250" /></a></td>
  66. </tr>
  67. <tr>
  68. <td class="es1" align="left"><?php echo $datos22['x_title'];?></td>
  69. </tr>
  70. <tr>
  71. <td class="es2"align="left"><?php echo $datos22['x_text_mini'];?> <a href="post.php?pagina=0&id=<?php echo $datos22['x_id']; ?>">(Leer más..)</a></td>
  72. </tr>
  73. <br>
  74.  
  75.  
  76. </td>
  77. </tr>
  78. <?php } while ($datos22 = mysql_fetch_assoc($datos1)); ?>
  79. </td>
  80. <td width="57%">
  81. <table width="100%" border="0" cellpadding="0" cellspacing="0">
  82. <?php do { ?>
  83. <tr>
  84. <td align="left"><table width="200" border="0" align="center">
  85. <tr>
  86. <td align=left >
  87. <a href="post.php?pagina=0&id=<?php echo $datos11['x_id']; ?>"><img src="<?php echo $datos11['x_imagen_article']; ?>" width="310" height="250" /></a></td>
  88. </tr>
  89. <tr>
  90. <td class="es1" align="left"><?php echo $datos11['x_title'];?></td>
  91. </tr>
  92. <tr>
  93. <td class="es2" align="left"><?php echo $datos11['x_text_mini'];?><a href="post.php?pagina=0&id=<?php echo $datos11['x_id']; ?>"> (Leer más..)</a></td>
  94. </tr>
  95. <br>
  96. </td>
  97. </tr>
  98. <?php } while ($datos11 = mysql_fetch_assoc($datos2)); ?>
  99. </table></td></tr>
  100. <br>
  101. <br>
  102. <table width="648">
  103. <tr>
  104. <td width="316" align="center"height="72"><div align="center"> <?php if($num_rows != 0)
  105. {
  106. $nextpage= $page +1;
  107. $prevpage= $page -1;
  108.  
  109. ?><ul id="pagination"><?php
  110.  
  111. if ($page == 1)
  112. {
  113. ?>
  114. <li class="previous-off">&laquo; Anterior</li>
  115. <li class="active">1</li>
  116.  
  117. <?php for($i= $page+1; $i<= $lastpage ; $i++) { ?>
  118. <li><a href="home.php?pagina=<?php echo $i;?>"><?php echo $i;?></a></li>
  119. <?php } if($lastpage >$page ){?>
  120. <li class="next"><a href="home.php?pagina=<?php echo $nextpage;?>" >Siguiente &raquo;</a></li><?php }else{?>
  121. <li class="next-off">Siguiente &raquo;</li><?php }} else { ?>
  122. <li class="previous"><a href="home.php?pagina=<?php echo $prevpage;?>">&laquo; Anterior</a></li><?php
  123. for($i= 1; $i<= $lastpage ; $i++) { if($page == $i) { ?> <li class="active"><?php echo $i;?></li><?php
  124. } else { ?> <li><a href="home.php?pagina=<?php echo $i;?>" ><?php echo $i;?></a></li><?php
  125. }} if($lastpage >$page ){ ?>
  126. <li class="next"><a href="home.php?pagina=<?php echo $nextpage;?>">Siguiente &raquo;</a></li><?php
  127. } else { ?> <li class="next-off">Siguiente &raquo;</li><?php
  128. }} ?></ul><?php } ?></div></td>
  129. </tr>
  130. </html>
[/HIGHLIGHT]