Ver Mensaje Individual
  #10 (permalink)  
Antiguo 05/10/2010, 14:36
zapt142
 
Fecha de Ingreso: julio-2010
Ubicación: La Ciudad Blanca, Mérida-Yucatán
Mensajes: 375
Antigüedad: 13 años, 9 meses
Puntos: 7
Respuesta: Busqueda por medio de combobox

tendre que ver que la consulta la hago despues del form?

mira te muestro completo el archivo noticias.php

Código PHP:
Ver original
  1. $query = "select count(*) as suma from noticias where mes = '$mes' and anio = '$ano'";
  2.                       $res = mysql_query($query,$conn) or die(mysql_error());
  3.                       $fila = mysql_fetch_array($res);
  4.                       $filas_pagina = 15;
  5.                        $numpaginas = ceil($fila['suma']/$filas_pagina);
  6.  
  7. if(isset($_REQUEST['pagina']))
  8. {
  9.     $pagina=$_REQUEST['pagina'];
  10. }
  11. else
  12. {
  13.     $pagina = 1;
  14. }
  15.                    
  16.  
  17. ?>
  18. <html>
  19. <head>
  20. <title>Noticias</title>
  21. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  22. <style type="text/css">
  23. <!--
  24. body {
  25.     background-image: url(images/fondoadmin.jpg);
  26.     background-repeat: repeat-x;
  27. }
  28. -->
  29. </style>
  30. <link href="file:///C|/wamp/www/el faroadmin/text.css" rel="stylesheet" type="text/css">
  31. </script>
  32. </head>
  33. <body bgcolor="#EBEBDC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  34. <!-- ImageReady Slices (elfaro_administrador.psd) -->
  35. <table width="1100" height="210" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
  36. <tr>
  37.         <td height="121" valign="top">
  38.             <img src="images/elfaro_administrador_01.jpg" width="1100" height="121" alt=""></td>
  39.   </tr>
  40.     <tr>
  41.         <td height="26" valign="top">
  42.             <img src="images/botonesmenu/btnsnoticias.jpg" width="1100" height="26" alt=""></td>
  43.   </tr>
  44.     <tr>
  45.         <td width="1100" height="44" valign="top"><table width="1097" border="0" cellpadding="0" cellspacing="0">
  46.           <tr>
  47.             <td width="63" height="7"></td>
  48.             <td width="840"></td>
  49.             <td width="194"></td>
  50.           </tr>
  51.           <tr>
  52.             <td>&nbsp;</td>
  53.             <td class="texttituloseccion">:: <span class="Tituloseccion">Noticias</span></td>
  54.             <td><!--BTN DE AGREGAR --><img src="images/botones/agregarmas.jpg" width="121" height="24"></td>
  55.           </tr>
  56.         </table></td>
  57.   </tr>
  58.     <tr>
  59.         <td height="19" valign="top"><table width="1099" border="0" cellpadding="0" cellspacing="0">
  60.           <tr>
  61.             <td>&nbsp;</td>
  62.             <td></td>
  63.             <td>&nbsp;</td>
  64.           </tr>
  65.           <tr>
  66.             <td>&nbsp;</td>
  67.             <td class="general">Filtrar por seccion Perteneciente: <form name="form" action="noticias.php" method="post"><select name="busqueda">
  68.  
  69.  <option value="0">Ver Todas</option>
  70.             <?php
  71.             $ssql = "select * from seccion";
  72.             $ql = mysql_query($ssql,$conn) or die(mysql_error());
  73.             while($g = mysql_fetch_array($ql)){
  74.             if($g['seccion'] == 'noticias de campeche'){
  75. echo '<option value="'.$g['id_seccion'].'">Noticias De Campeche</option>';
  76. }
  77. if($g['seccion'] == 'espectaculos'){
  78. echo '<option value="'.$g['id_seccion'].'">Espectáculos</option>';
  79. }
  80. if($g['seccion'] == 'deportes'){
  81. echo '<option value="'.$g['id_seccion'].'">Deportes</option>';
  82. }
  83. if($g['seccion'] == 'mexico y el mundo'){
  84. echo '<option value="'.$g['id_seccion'].'">México y El Mundo</option>';
  85. }
  86. if($g['seccion'] == 'reportajes'){
  87. echo '<option value="'.$g['id_seccion'].'">Reportajes</option>';
  88. }
  89. if($g['seccion'] == 'mundo maya'){
  90. echo '<option value="'.$g['id_seccion'].'">Mundo Maya</option>';
  91. }
  92. if($g['seccion'] == 'lo insolito'){
  93. echo '<option value="'.$g['id_seccion'].'">Lo Insolito</option>';
  94. }
  95. if($g['seccion'] == 'eventos'){
  96. echo '<option value="'.$g['id_seccion'].'">Eventos</option>';
  97. }
  98. if($g['seccion'] == 'opinion'){
  99. echo '<option value="'.$g['id_seccion'].'">Opinión</option>';
  100. }
  101.             }
  102.             ?>
  103.             </select></form></td>
  104.             <td>&nbsp;</td>
  105.           </tr>
  106.           <tr>
  107.             <td width="85" height="7"></td>
  108.             <td width="929"></td>
  109.             <td width="85"></td>
  110.           </tr>
  111.           <tr>
  112.             <td>&nbsp;</td>
  113.             <td><!--AQUI VAS A PONER TU INFO -->
  114.               <table width="928" height="49" border="0" cellpadding="0" cellspacing="0">
  115.                 <tr>
  116.                   <td><table width="929" border="0" cellpadding="0" cellspacing="1">
  117.                     <tr>
  118.                       <td width="19" bgcolor="dcedfd">&nbsp;</td>
  119.                       <td width="597" bgcolor="dcedfd" class="general">Selecione una noticia a editar</td>
  120.                       <td width="313" bgcolor="dcedfd" class="numerodetal"> &nbsp;Numero de Noticias Actuales:<?php            
  121.                       echo $fila['suma'];
  122.                       ?></td>
  123.                     </tr>
  124.                   </table></td>
  125.                 </tr>
  126.                 <tr>
  127.                   <td><table width="928" border="0" cellpadding="0" cellspacing="0">
  128.                     <tr>
  129.                       <td width="616" height="23" bgcolor="d8d8d8" class="titucolumnas"><div align="left">&nbsp;&nbsp;Nombre de Noticia</div></td>
  130.                       <td width="143" bgcolor="d8d8d8" class="titucolumnas"><div align="center">Secci&oacute;n</div></td>
  131.                       <td width="96" bgcolor="d8d8d8" class="titucolumnas"><div align="center">Publicada</div></td>
  132.                       <td width="73" bgcolor="d8d8d8" class="titucolumnas"><div align="center">Eliminar</div></td>
  133.                     </tr>
  134.                     <?php
  135.                     echo "<pre>";print_r($_POST);echo "</pre>";
  136.                     //if($_POST['busqueda'] == 0){
  137.                     $sql = "select * from noticias where mes = '$mes' and anio = '$ano' limit ".(($pagina-1)*$filas_pagina).",".$filas_pagina;  //}
  138.                     /*else{
  139.                         $sql = "select * from noticias where mes = '$mes' and anio = '$ano' and seccion = ".$_POST['busqueda']." limit ".(($pagina-1)*$filas_pagina).",".$filas_pagina;}*/
  140.                     $result = mysql_query($sql,$conn) or die(mysql_error());
  141.                     while($row = mysql_fetch_array($result)){
  142.                     echo '<tr>';
  143.                     echo '<td><a href="edit_noticias.php?id_noticia='.$row['id_noticia'].'">'.$row['titulo'].'</a></td>';
  144.                     $do = "select * from seccion where id_seccion =".$row['seccion'];
  145.                     $done = mysql_query($do,$conn) or die(mysql_error());
  146.                     $a = mysql_fetch_array($done);
  147.                     if($a['seccion'] == 'noticias de campeche'){
  148. echo '<td align="center">Noticias De Campeche</td>';
  149. }
  150. if($a['seccion'] == 'espectaculos'){
  151. echo '<td align="center">Espectáculos</td>';
  152. }
  153. if($a['seccion'] == 'deportes'){
  154. echo '<td align="center">Deportes</td>';
  155. }
  156. if($a['seccion'] == 'mexico y el mundo'){
  157. echo '<td align="center">México y El Mundo</td>';
  158. }
  159. if($a['seccion'] == 'reportajes'){
  160. echo '<td align="center">Reportajes</td>';
  161. }
  162. if($a['seccion'] == 'mundo maya'){
  163. echo '<td align="center">Mundo Maya</td>';
  164. }
  165. if($a['seccion'] == 'lo insolito'){
  166. echo '<td align="center">Lo Insolito</td>';
  167. }
  168. if($a['seccion'] == 'eventos'){
  169. echo '<td align="center">Eventos</td>';
  170. }
  171. if($a['seccion'] == 'opinion'){
  172. echo '<td align="center">Opinión</td>';
  173. }
  174. echo '<td align="center">'.$row['publicada'].'</td>';
  175. echo '<td align="center"><a href="elim_noticia.php?id_noticia='.$row['id_noticia'].'"><img src="images/botones/eliminar.jpg" /></a></td>';
  176.                     echo '</tr>';
  177.                     }
  178.                     ?>
  179.                   </table>
  180.                   <?php
  181.                   echo '<table  cellspacing="3" height="50">';
  182. echo "<tr>";
  183.  
  184. if ($pagina!=1)
  185. {
  186. echo '<td class="nproduct"><strong><a href="noticias.php?pagina=1" style="color:#793f00; text-decoration:none"> << </a></strong></td>';
  187. echo '<td class="nproduct"><strong><a href="noticias.php?pagina='.($pagina-1).' "style="color:#793f00; text-decoration:none"> < </a></strong></td>';
  188. }
  189.  
  190. for($i=1;$i<=$numpaginas;$i++)
  191. {
  192.     $temp='';
  193.     if ($i==$pagina)
  194.         $temp=$i;
  195.     else
  196.         $temp='<a href="noticias.php?pagina='.$i.'" style="color:#000000; text-decoration:none">'.$i.'</a>';
  197.     echo '<td><strong>'.$temp.'</strong></td>'."\n";
  198. }
  199.  
  200. if ($pagina!=$numpaginas)
  201. {
  202.     echo '<td><strong><a href="noticias.php?pagina='.($pagina+1).'" style="color:#000000; text-decoration:none"> > </a></strong></td>';
  203.     echo '<td><strong><a href="noticias.php?pagina='.$numpaginas.'" style="color:#000000; text-decoration:none"> >> </a></strong></td>';
  204.  
  205. }
  206.  
  207. echo "</tr>";
  208. echo "</table>";
  209.  
  210.  
  211.                   ?></td>
  212.                 </tr>
  213.               </table></td>
  214.             <td>&nbsp;</td>
  215.           </tr>
  216.         </table></td>
  217.   </tr>
  218. </table>
  219. <!-- End ImageReady Slices -->
  220. </body>
  221. </html>

gracias de antemano
__________________
--No todos aprendemos de la misma forma, ni a la misma velocidad---