Ver Mensaje Individual
  #3 (permalink)  
Antiguo 24/02/2012, 13:35
chumy_
 
Fecha de Ingreso: noviembre-2011
Mensajes: 121
Antigüedad: 12 años, 5 meses
Puntos: 0
Respuesta: como ver todas las filas de una tabla con select que filtra

Y esta es la pagina que muestra los resultados:

Código PHP:
<?php require_once('Connections/localhost.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

$currentPage $_SERVER["PHP_SELF"];

$maxRows_Recordset1 10;
$pageNum_Recordset1 0;
if (isset(
$_GET['pageNum_Recordset1'])) {
  
$pageNum_Recordset1 $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 $pageNum_Recordset1 $maxRows_Recordset1;

$colname_Recordset1 "-1";
if (isset(
$_GET['noper'])) {
  
$colname_Recordset1 $_GET['noper'];
}
$estados_Recordset1 "-1";
if (isset(
$_GET['estados'])) {
  
$estados_Recordset1 $_GET['estados'];
}
mysql_select_db($database_localhost$localhost);
$query_Recordset1 sprintf("SELECT ncert, Fecha, proyecto, poblacion, calle, n, tipo_recinto, n1, artefacto, estado, estanqueidad FROM cert_validado WHERE cod_proy = %s AND estado = %s ORDER BY ncert ASC"GetSQLValueString($colname_Recordset1"text"),GetSQLValueString($estados_Recordset1"text"));
$query_limit_Recordset1 sprintf("%s LIMIT %d, %d"$query_Recordset1$startRow_Recordset1$maxRows_Recordset1);
$Recordset1 mysql_query($query_limit_Recordset1$localhost) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);

if (isset(
$_GET['totalRows_Recordset1'])) {
  
$totalRows_Recordset1 $_GET['totalRows_Recordset1'];
} else {
  
$all_Recordset1 mysql_query($query_Recordset1);
  
$totalRows_Recordset1 mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$queryString_Recordset1 "";
if (!empty(
$_SERVER['QUERY_STRING'])) {
  
$params explode("&"$_SERVER['QUERY_STRING']);
  
$newParams = array();
  foreach (
$params as $param) {
    if (
stristr($param"pageNum_Recordset1") == false && 
        
stristr($param"totalRows_Recordset1") == false) {
      
array_push($newParams$param);
    }
  }
  if (
count($newParams) != 0) {
    
$queryString_Recordset1 "&" htmlentities(implode("&"$newParams));
  }
}
$queryString_Recordset1 sprintf("&totalRows_Recordset1=%d%s"$totalRows_Recordset1$queryString_Recordset1);
?>
<!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">
<head>
<style type="text/css">
<!--
 
TEXTAREA {
    background-color: #FFFFFF;
    border: black 1px solid;
    color: #000000;
    font-family: Arial;
    font-size: 10pt;
    font-weight: normal;


.Estilo1 {
    font-family: Arial;
    color: #000000;
    font-size: 12px;
    font-weight: bold;
}
.Estilo4 {
    font-family: Arial;
    color: #0000FF;
    font-size: 12px;
}
body {
    background-color: #FFFFFF;
}
.Estilo7 {
font-family: Arial;
font-size: 10px; 
}
-->
</style>
<script type="text/javascript">
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
</script>
</head>

<body>

  
</div></td>
<table width="950" border="0">
  <tr>
    <td width="87"><?php if ($pageNum_Recordset1 0) { // Show if not first page ?>
      <a href="<?php printf("%s?pageNum_Recordset1=%d%s"$currentPage0$queryString_Recordset1); ?>"><img src="imagenes/First.gif" alt="" /></a>
    <?php // Show if not first page ?></td>
    <td width="378"><?php if ($pageNum_Recordset1 0) { // Show if not first page ?>
      <a href="<?php printf("%s?pageNum_Recordset1=%d%s"$currentPagemax(0$pageNum_Recordset1 1), $queryString_Recordset1); ?>"><img src="imagenes/Previous.gif" alt="" /></a>
    <?php // Show if not first page ?></td>
    <td width="389" align="right"><?php if ($pageNum_Recordset1 $totalPages_Recordset1) { // Show if not last page ?>
      <a href="<?php printf("%s?pageNum_Recordset1=%d%s"$currentPagemin($totalPages_Recordset1$pageNum_Recordset1 1), $queryString_Recordset1); ?>"><img src="imagenes/Next.gif" alt="" /></a>
    <?php // Show if not last page ?></td>
    <td width="78" align="right"><?php if ($pageNum_Recordset1 $totalPages_Recordset1) { // Show if not last page ?>
      <a href="<?php printf("%s?pageNum_Recordset1=%d%s"$currentPage$totalPages_Recordset1$queryString_Recordset1); ?>"><img src="imagenes/Last.gif" alt="" /></a>
    <?php // Show if not last page ?></td>
  </tr>
</table>
<td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"></div></td>
<td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>>&nbsp;</td>
<td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>>&nbsp;</td>
<table width="950" border="0">
  <tr>
    <td colspan="13"><div align="center"><span class="Estilo7"><strong>Mantenci&oacute;n y Certificaci&oacute;n de Artefactos a Gas</strong></span>: <?php echo $row_Recordset1['proyecto']; ?></div></td>
  </tr>
  <tr>
    <td><div align="center" class="Estilo7"><strong>Nro. CERT.</strong></div></td>
    <td><div align="center" class="Estilo7"><strong>FECHA</strong></div></td>
    <td><div align="center" class="Estilo7"><strong>CALLE</strong></div></td>
    <td><div align="center" class="Estilo7"><strong>Nro.</strong></div></td>
    <td><div align="center" class="Estilo7"><strong>INSTALACION</strong></div></td>
    <td><div align="center" class="Estilo7"><strong>Nro.</strong></div></td>
    <td><div align="center" class="Estilo7"><strong>ARTEFACTO</strong></div></td>
    <td><div align="center" class="Estilo7"><strong>ESTADO</strong></div></td>
    <td><div align="center" class="Estilo7"><strong>ESTANQUEIDAD</strong></div></td>
    <td colspan="2"><div align="center" class="Estilo7"><strong>DOC.</strong></div></td>
  </tr>
  <?php do { ?>
<tr onmouseover="this.style.backgroundColor='#E8E8E8'" onmouseout="this.style.backgroundColor='#ffffff'">
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"><?php echo $row_Recordset1['ncert']; ?></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"><?php echo $row_Recordset1['Fecha']; ?></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"><?php echo $row_Recordset1['calle']; ?></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"><?php echo $row_Recordset1['n']; ?></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"><?php echo $row_Recordset1['tipo_recinto']; ?></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"><?php echo $row_Recordset1['n1']; ?></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"><?php echo $row_Recordset1['artefacto']; ?></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7"><?php echo $row_Recordset1['estado']; ?></div></td>
    <td <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><div align="center" class="Estilo7">
      <div align="center" class="Estilo7"><?php echo $row_Recordset1['estanqueidad']; ?></div>
    </div></td>
    <td align="center" <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>><form action="#"  method="post" name="form1" id="form1" onsubmit="MM_openBrWindow('genera_certificado.php?numcert=<?php echo $row_Recordset1['ncert']; ?>','Certificado','scrollbars=yes,width=800,height=600')">
      <input type="submit" name="numcert" id="numcert" value="Ver" />
    </form></td>
    <td align="center" <?php //if ($c % 2 == 0) echo 'bgcolor="#E8E8E8"' ?>>
      <a href="#"><img src="botones/mail1.gif" alt="Email" name="numcert"  width="24" height="24" border="0" id="numcert" onclick="javascript:this.src='botones/mail2.gif';MM_openBrWindow('envia_correo.php?numcert=<?php echo $row_Recordset1['ncert']; ?>','','scrollbars=yes,width=400,height=300')" onmouseover="javascript:this.src='botones/mail2.gif'" onmouseout="javascript:this.src='botones/mail1.gif'" /></a>
      </td>
    </tr>
    <?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?>
</table>