Gracias.
Anexo los dos codigos uno es el buscador y el otro lo que muestra. Hay otra tabla que es la de las instituciones en la cual el buscador consulta, y la tabla pedidos alli igualo por los id de las instituciones que requieren o piden algo
Buscador
Código PHP:
Ver original<?php require_once('Connections/pailinea.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
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;
}
}
$maxRows_BuscarIPS = 10;
$pageNum_BuscarIPS = 0;
if (isset($_GET['pageNum_BuscarIPS'])) { $pageNum_BuscarIPS = $_GET['pageNum_BuscarIPS'];
}
$startRow_BuscarIPS = $pageNum_BuscarIPS * $maxRows_BuscarIPS;
$colname_BuscarIPS = "-1";
if (isset($_POST['nombre'])) { $colname_BuscarIPS = $_POST['nombre'];
}
$query_BuscarIPS = sprintf("SELECT cod_ips, nombre FROM ips WHERE nombre LIKE %s", GetSQLValueString
("%" . $colname_BuscarIPS . "%", "text")); $query_limit_BuscarIPS = sprintf("%s LIMIT %d, %d", $query_BuscarIPS, $startRow_BuscarIPS, $maxRows_BuscarIPS);
if (isset($_GET['totalRows_BuscarIPS'])) { $totalRows_BuscarIPS = $_GET['totalRows_BuscarIPS'];
} else {
}
$totalPages_BuscarIPS = ceil($totalRows_BuscarIPS/$maxRows_BuscarIPS)-1; ?><!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>
<body>
<p> </p>
<form id="form1" name="form1" method="post" action="">
<p>Buscar
<label>
<input type="text" name="nombre" id="nombre" />
</label>
</p>
<p>
<label>
<input type="submit" name="buscar" id="buscar" value="Enviar" />
</label>
</p>
</form>
<?php do { ?>
<p><a href="verpedidoips.php?cod_ips=<?php echo $row_BuscarIPS['cod_ips']; ?>"><?php echo $row_BuscarIPS['nombre']; ?></a></p>
</html>
<?php
?>
Resultado
Código PHP:
Ver original<?php require_once('Connections/pailinea.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
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;
}
}
$maxRows_MostrarPedido = 10;
$pageNum_MostrarPedido = 0;
if (isset($_GET['pageNum_MostrarPedido'])) { $pageNum_MostrarPedido = $_GET['pageNum_MostrarPedido'];
}
$startRow_MostrarPedido = $pageNum_MostrarPedido * $maxRows_MostrarPedido;
$colname_MostrarPedido = "-1";
if (isset($_GET['cod_ips'])) { $colname_MostrarPedido = $_GET['cod_ips'];
}
$query_MostrarPedido = sprintf("SELECT * FROM pedidos WHERE cod_ips = %s", GetSQLValueString
($colname_MostrarPedido, "int")); $query_limit_MostrarPedido = sprintf("%s LIMIT %d, %d", $query_MostrarPedido, $startRow_MostrarPedido, $maxRows_MostrarPedido);
if (isset($_GET['totalRows_MostrarPedido'])) { $totalRows_MostrarPedido = $_GET['totalRows_MostrarPedido'];
} else {
$all_MostrarPedido = mysql_query($query_MostrarPedido); }
$totalPages_MostrarPedido = ceil($totalRows_MostrarPedido/$maxRows_MostrarPedido)-1;
$query_ObtenerIPS = "SELECT ips.cod_ips, ips.nombre, pedidos.cod_ips FROM ips, pedidos WHERE ips.cod_ips = pedidos.cod_ips";
$colname_Recordset1 = "-1";
if (isset($_GET['cod_ips'])) { $colname_Recordset1 = $_GET['cod_ips'];
}
$query_Recordset1 = sprintf("SELECT cod_ips, nombre FROM ips WHERE cod_ips = %s", GetSQLValueString
($colname_Recordset1, "int")); ?><!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<script type="text/javascript" src="ExportarExcel/jquery-1.3.2.min.js"></script>
<script language="javascript">
$(document).ready(function() {
$(".botonExcel").click(function(event) {
$("#datos_a_enviar").val( $("<div>").append( $("#Exportar_a_Excel").eq(0).clone()).html());
$("#FormularioExportacion").submit();
});
});
</script>
<link href="estilo/styles.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.Estilo1 {color: #000000}
.Estilo2 {color: #FF0000}
.botonExcel {cursor:pointer;}
-->
</style>
</head>
<body>
<p> </p>
<form id="form1" name="form1" method="post" action="">
<?php echo $row_Recordset1['nombre']; ?>
<table width="792" border="0" align="center" id="Exportar_a_Excel">
<tr>
<td width="143" class="text3"><div align="center"><span class="Estilo1">Fecha de Solicitud</span></div></td>
<td width="123" class="text3"><div align="center"><span class="Estilo1">Suministro</span></div></td>
<td width="135" class="text3"><div align="center"><span class="Estilo1">Presentación</span></div></td>
<td width="153" class="text3"><div align="center"><span class="Estilo1">Casa Productora</span></div></td>
<td width="116" class="text3"><div align="center"><span class="Estilo1">Cantidad</span></div></td>
<td width="96" class="text3"><div align="center"><span class="Estilo1">Despachada</span></div></td>
</tr>
<?php do { ?>
<tr class="text3">
<td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['fecha_solicitud']; ?></div></td>
<td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['suministro']; ?></div></td>
<td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['presentacion']; ?></div></td>
<td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['casa_productora']; ?></div></td>
<td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['cantidad']; ?></div></td>
<td class="Estilo2"><label>
<div align="center">
<input name="despachada" type="text" class="Estilo1" id="despachada" value="<?php echo $row_MostrarPedido['entregada']; ?>" />
</div>
</label></td>
</tr>
</table>
<label>
<input type="submit" name="registrar" id="registrar" value="Enviar" />
</label>
<input name="cod_ips" type="hidden" id="cod_ips" value="<?php echo $row_MostrarPedido['cod_ips']; ?>" />
<input name="cod_ips" type="hidden" id="cod_ips" value="<?php echo $row_Recordset1['cod_ips']; ?>" />
</form>
<p> </p>
<p> </p>
</body>
</html>
<?php
?>
Muchas gracias por la ayuda. Si eso no es lo que me pedias, por favor disculpame.