Ver Mensaje Individual
  #22 (permalink)  
Antiguo 21/09/2011, 21:27
juangemelo01
 
Fecha de Ingreso: marzo-2011
Ubicación: Oaxaca
Mensajes: 252
Antigüedad: 13 años, 1 mes
Puntos: 17
Respuesta: Problema con SWICH y filtro en PHP y MYSQL

Hola Gracias por responder, este es el codigo de la pagina de BUSCADOR.php

Código PHP:
<?php require_once('Connections/pagina.php'); ?>
<?php
$currentPage 
$_SERVER["PHP_SELF"];

$maxRows_ clasificador 10;
$pageNum_ clasificador 0;
if (isset(
$_GET['pageNum_clasificador'])) {
  
$pageNum_clasificador $_GET['pageNum_clasificador'];
}
$startRow_clasificador $pageNum_clasificador $maxRows_clasificador;

$colname_clasificador "-1";
if (isset(
$_GET['busqueda'])) {
  
$colname_clasificador = (get_magic_quotes_gpc()) ? $_GET['busqueda'] : addslashes($_GET['busqueda']);
}
mysql_select_db($database_clasificador$row_clasificador);
$query_clasificador sprintf("SELECT * FROM busqueda WHERE TITULO AND DESCRIPCION LIKE '%%%s%%' OR TITULO LIKE '%%%s%%'  "$colname_clasificador,$colname_clasificador);
$query_limit_clasificador sprintf("%s LIMIT %d, %d"$query_clasificador$startRow_clasificador$maxRows_clasificador);
$clasificador mysql_query($query_limit_clasificador$row_clasificador) or die(mysql_error());
$row_clasificadormysql_fetch_assoc $row_clasificador);

if (isset(
$_GET['totalRows_clasificador'])) {
  
$totalRows_clasificador $_GET['totalRows_clasificador'];
} else {
  
$all_clasificador mysql_query($query_clasificador);
  
$totalRows_clasificador mysql_num_rows($all_clasificador);
}
$totalPages_clasificador ceil($totalRows_clasificador/$maxRows_clasificador)-1;

$queryString_clasificador "";
if (!empty(
$_SERVER['QUERY_STRING'])) {
  
$params explode("&"$_SERVER['QUERY_STRING']);
  
$newParams = array();
  foreach (
$params as $param) {
    if (
stristr($param"pageNum_clasificador") == false && 
        
stristr($param"totalRows_clasificador") == false) {
      
array_push($newParams$param);
    }
  }
  if (
count($newParams) != 0) {
    
$queryString_clasificador "&" htmlentities(implode("&"$newParams));
  }
}
$queryString_clasificador sprintf("&totalRows_clasificador=%d%s"$totalRows_clasificador$queryString_clasificador);
?>
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- DW6 -->
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<title>BUSCADOR XD</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="mm_health_nutr.css" type="text/css" />
<script language="JavaScript" type="text/javascript">
//--------------- LOCALIZEABLE GLOBALS ---------------
var d=new Date();
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
//---------------   END LOCALIZEABLE   ---------------
</script>
<style type="text/css">
<!--
#Layer1 {
	position:absolute;
	width:181px;
	height:330px;
	z-index:1;
	left: 98px;
	top: 182px;
}
#Layer2 {
	position:absolute;
	width:286px;
	height:60px;
	z-index:1;
	left: 466px;
	top: 23px;
}
.Estilo6 {color: #000000; font-size: 14px; }
.Estilo7 {color: #000000; font-size: 14px; font-weight: bold; }
.Estilo10 {
	color: #FF0000;
	font-size: 12;
}
.Estilo11 {color: #0000FF; font-size: 12; }
.Estilo12 {color: #000000; font-size: 12px; }
.Estilo15 {
	color: #FF0000;
	font-size: 14px;
}
.Estilo16 {
	color: #0000FF;
	font-size: 14px;
}
-->
</style>
</head>
<body bgcolor="#F4FFE4">
<table width="802" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
	<td height="107" colspan="5"><img src="DISEÑO WEB/CABECERA.gif" width="800" height="100" /></td>
</tr>


  <tr>
    <td colspan="5" bgcolor="#5C743D"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
  </tr>

  <tr>
    <td colspan="5" bgcolor="#99CC66" background="mm_dashed_line.gif"><img src="mm_dashed_line.gif" alt="line decor" width="4" height="3" border="0" /></td>
  </tr>
  <tr bgcolor="#99CC66">
  <td height="20" colspan="2">&nbsp;</td>
  	<td height="20" colspan="2" id="dateformat"><form id="form1" name="form1" method="get" action="Buscador.php">
      <label></label>
      <label> </label>
      <div align="center">
        <input name="busqueda" type="text" id="busqueda" size="50" maxlength="100" />
        <input name="Buscar" type="submit" id="Buscar" value="Buscar" />
      </div>
    </form></td>
    <td height="20" id="dateformat">&nbsp;</td>
  </tr>

  <tr>
    <td colspan="5" bgcolor="#99CC66" background="mm_dashed_line.gif"><img src="mm_dashed_line.gif" alt="line decor" width="4" height="3" border="0" /></td>
  </tr>

  <tr>
    <td colspan="5" bgcolor="#5C743D"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
  </tr>
 <tr>
    <td width="4" height="331">&nbsp;</td>
    <td colspan="2" valign="top"><div align="center"><span class="pageName">&nbsp;Resultados</span></div>
      <table width="685" border="0" align="center" cellpadding="2" cellspacing="0">
        <tr>
          <td width="681" height="291" colspan="7" class="pageName"><table border="0" align="center" cellspacing="4">
            <tr>
              <td><div align="center"></div></td>
              <td><div align="center" class="Estilo7">TITULO</div></td>
              <td><div align="center" class="Estilo7">TIPO</div></td>
              <td><div align="center" class="Estilo7">PAIS</div></td>
            </tr>
            <?php do { ?>
  <tr>
              <td><div align="center" class="Estilo6"> 
Código PHP:
 <a href="<?php
        
if (isset($_GET['CLAVE'])){
                 switch (
$_GET['CLAVE']){                  
                case 
"tecnologia":
                  
$page ="TECNOLOGIA/tecnologia.php?CLAVE=".$row_clasificador ['CLAVE'];                      
               echo 
$page;                    
               break;                  
               case 
"Vehiculos":
                 
$page "VEHICULOS/Vehiculos.php?CLAVE=".$row_clasificador['CLAVE'];                      
               echo 
$page;                  
               break;
                    }
               }else{
         
// valor por defecto si no recibe valor del get
    
$page "VEHICULOS/Vehiculos.php?CLAVE=".$row_clasificador['CLAVE'];                      
               echo 
$page;
              }
         
?>
Código HTML:
    ">
    <img src="<?php echo $row_clasificador['IMAGEN1']; ?>" width="74" border="0" /></a></div></td>
              <td><div align="center" class="Estilo6">
                <div align="left" class="Estilo11"><?php echo $row_clasificador['TITULO']; ?></div>
              </div></td>
              <td><div align="center" class="Estilo6">
                <div align="left" class="Estilo11"><?php echo $row_clasificador['TIPO']; ?></div>
              </div></td>
              <td><div align="center" class="Estilo6">
                <div align="right" class="Estilo10">
                  <div align="center"><?php echo $row_clasificador ['PAIS']; ?></div>
                </div>
              </div></td>
            </tr>
            <?php } while ($row_clasificador = mysql_fetch_assoc($clasificador)); ?>
          </table>
            <p class="Estilo12">Registros <?php echo ($startRow_clasificador + 1) ?> a <?php echo min($startRow_clasificador + $maxRows_clasificador, $totalRows_clasificador) ?> de <?php echo $totalRows_clasificador ?></p>
            <table border="0" width="50%" align="center">
              <tr>
                <td width="23%" align="center"><?php if ($pageNum_clasificador > 0) { // Show if not first page ?>
                      <a href="<?php printf("%s?pageNum_clasificador=%d%s", $currentPage, 0, $queryString_clasificador); ?>">Primero</a>
                      <?php } // Show if not first page ?>
                </td>
                <td width="31%" align="center"><?php if ($pageNum_clasificador > 0) { // Show if not first page ?>
                      <a href="<?php printf("%s?pageNum_clasificador=%d%s", $currentPage, max(0, $pageNum_clasificador - 1), $queryString_clasificador); ?>">Anterior</a>
                      <?php } // Show if not first page ?>
                </td>
                <td width="23%" align="center"><?php if ($pageNum_clasificador < $totalPages_clasificador) { // Show if not last page ?>
                      <a href="<?php printf("%s?pageNum_clasificador=%d%s", $currentPage, min($totalPages_clasificador, $pageNum_clasificador + 1), $queryString_clasificador); ?>">Siguiente</a>
                      <?php } // Show if not last page ?>
                </td>
                <td width="23%" align="center"><?php if ($pageNum_clasificador < $totalPages_clasificador) { // Show if not last page ?>
                      <a href="<?php printf("%s?pageNum_clasificador=%d%s", $currentPage, $totalPages_clasificador, $queryString_clasificador); ?>">&Uacute;ltimo</a>
                      <?php } // Show if not last page ?>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table></td>
    <td colspan="2">&nbsp;</td>
  </tr>
 

 <tr>
    <td height="19">&nbsp;</td>
    <td width="7">&nbsp;</td>
    <td width="678">&nbsp;</td>
	<td width="4">&nbsp;</td>
	<td width="109">&nbsp;</td>
  </tr>
</table>
<table width="800" height="90" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr bgcolor="#99CC66">
    <td width="10" bordercolor="#FFFFFF" bgcolor="#FFFFFF">&nbsp;</td>
    <td colspan="2" bgcolor="#FFFFFF">&nbsp;</td>
    <td width="10" height="90" colspan="5" bgcolor="#FFFFFF" id="dateformat">&nbsp;</td>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html> 
Código PHP:
<?php
mysql_free_result
($clasificador);
?>
Gracias amigo y espero tu respuesta