Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/12/2004, 09:52
juanqyf
 
Fecha de Ingreso: diciembre-2004
Mensajes: 8
Antigüedad: 19 años, 4 meses
Puntos: 0
como puedo Filtrar tabla de datos en php

Hola grupo, aun me es dificil entender el codigo de php, lo que deseo es que una tabla de datos de postgre que se presenta en una pagina sea filtrada por el resultado de 4 select en esa misma pagina no como la intruccion maestro detalles de sreamweaver que me lo realiza en dos paginas. les muestro el codigo por si alguien me puede ayudar.

Gracias de ante mano:
JUAN CARLOS DIAZ MORILLO

<?php
//Connection statement
require_once('Connections/dsnPostgres.php');

// begin Recordset
$maxRows_rsCasos = 10;
$pageNum_rsCasos = 0;
if (isset($HTTP_GET_VARS['pageNum_rsCasos'])) {
$pageNum_rsCasos = $HTTP_GET_VARS['pageNum_rsCasos'];
}
$startRow_rsCasos = $pageNum_rsCasos * $maxRows_rsCasos;
$query_rsCasos = "SELECT * FROM casos";
$rsCasos = $dsnPostgres->SelectLimit($query_rsCasos, $maxRows_rsCasos, $startRow_rsCasos) or die($dsnPostgres->ErrorMsg());
if (isset($HTTP_GET_VARS['totalRows_rsCasos'])) {
$totalRows_rsCasos = $HTTP_GET_VARS['totalRows_rsCasos'];
} else {
$all_rsCasos = $dsnPostgres->SelectLimit($query_rsCasos) or die($dsnPostgres->ErrorMsg());
$totalRows_rsCasos = $all_rsCasos->RecordCount();
}
$totalPages_rsCasos = (int)(($totalRows_rsCasos-1)/$maxRows_rsCasos);
// end Recordset

// begin Recordset
$query_rsClientes = "SELECT clientes.idcliente, clientes.nit, clientes.nombrecompania FROM clientes";
$rsClientes = $dsnPostgres->SelectLimit($query_rsClientes) or die($dsnPostgres->ErrorMsg());
$totalRows_rsClientes = $rsClientes->RecordCount();
// end Recordset
//PHP ADODB document - made with PHAkt 2.8.2?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="100%" border="0">
<tr>
<td width="285"><img src="binnACLE03.jpg" width="285" height="85"></td>
<td width="302">&nbsp;</td>
<td width="152"><img src="sweb.jpg" width="169" height="83"></td>
</tr>
</table>
<table width="100%" border="0">
<tr bgcolor="#A3B2CC">
<td height="26" colspan="3"><div align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="660" height="41">
<param name="movie" value="navbar.swf">
<param name="quality" value="high">
<embed src="navbar.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="660" height="41"></embed>
</object>
</div></td>
</tr>
</table>
<hr>
<form name="form1" method="post" action="">
<table width="50%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="20%" scope="row"><div align="left">Nit</div></th>
<td width="80%"><select name="sNit" id="sNit">
<?php
while(!$rsClientes->EOF){
?>
<option value="<?php echo $rsClientes->Fields('nit')?>"><?php echo $rsClientes->Fields('nit')?></option>
<?php
$rsClientes->MoveNext();
}
$rsClientes->MoveFirst();
?>
</select></td>
</tr>
<tr>
<th scope="row"><div align="left">Razon Social</div></th>
<td><select name="sRS" id="sRS">
<?php
while(!$rsClientes->EOF){
?>
<option value="<?php echo $rsClientes->Fields('nombrecompania')?>"><?php echo $rsClientes->Fields('nombrecompania')?></option>
<?php
$rsClientes->MoveNext();
}
$rsClientes->MoveFirst();
?>
</select></td>
</tr>
<tr>
<th scope="row"><div align="left">No Caso</div></th>
<td><select name="sNoCaso" id="sNoCaso">
<?php
while(!$rsCasos->EOF){
?>
<option value="<?php echo $rsCasos->Fields('numerocaso')?>"><?php echo $rsCasos->Fields('numerocaso')?></option>
<?php
$rsCasos->MoveNext();
}
$rsCasos->MoveFirst();
?>
</select></td>
</tr>
<tr>
<th scope="row"><div align="left">Estado </div></th>
<td><select name="sEstado" id="sEstado">
<option value="Abierto">Abierto</option>
<option value="Cerrado">Cerrado</option>
<option value="Pendiente de repuesto">Pendiente de repuesto</option>
<option value="Pendiente de respuesta del fabricante">Pendiente de respuesta del fabricante</option>
<option value="Pendiente de respuesta nuestra">Pendiente de respuesta nuestra</option>
</select></td>
</tr>
</table>
<p><input type="submit" name="Submit" value="Filtrar">
<input type="reset" name="Submit2" value="Cancelar">
</p>
</form>
<hr>
<div align="left">

<p>
<input type="submit" name="Submit3" value="Nuevo caso">
<input type="submit" name="Submit4" value="Regresar">
</p>
<p>listado de Casos pendientes</p>
<table border="1" cellpadding="0" cellspacing="0">
<tr bgcolor="#6699CC">
<td>numerocaso</td>
<td>tipo_soporte</td>
<td>responsable</td>
<td>contrato</td>
<td>cliente</td>
<td>estado</td>
<td>fecha</td>
<td>observaciones</td>
<td>fechaseguimiento</td>
<td>faricante</td>
</tr>
<?php
while (!$rsCasos->EOF) {
?>
<tr>
<td><?php echo $rsCasos->Fields('numerocaso'); ?></td>
<td><?php echo $rsCasos->Fields('tipo_soporte'); ?></td>
<td><?php echo $rsCasos->Fields('responsable'); ?></td>
<td><?php echo $rsCasos->Fields('contrato'); ?></td>
<td><?php echo $rsCasos->Fields('cliente'); ?></td>
<td><?php echo $rsCasos->Fields('estado'); ?></td>
<td><?php echo $rsCasos->Fields('fecha'); ?></td>
<td><?php echo $rsCasos->Fields('observaciones'); ?></td>
<td><?php echo $rsCasos->Fields('fechaseguimiento'); ?></td>
<td><?php echo $rsCasos->Fields('faricante'); ?></td>
</tr>
<?php
$rsCasos->MoveNext();
}
?>
</table>
<p>&nbsp;</p>
</div>

</body>
</html>
<?php
$rsCasos->Close();

$rsClientes->Close();
?>