Ver Mensaje Individual
  #6 (permalink)  
Antiguo 23/01/2008, 15:11
yairo_gioel
 
Fecha de Ingreso: abril-2007
Mensajes: 20
Antigüedad: 17 años
Puntos: 0
Re: Buscar en la base de datos

BUENO, NO FUNCIONA, LES EXPLICO: TENGO UNA PAGINA DE BUSQUEDA:

buscar_socio.php

<?php
session_start();
if($_SESSION['nivel']==1){
}else{
//header("Location: bebidas.php?error=No tiene acceso al club de socios");
}
?>
<? include("../conexion.php");?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="69%" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td><div align="center"><a href="socios.php">Agregar socio </a> | <span class="Estilo3">Modificar datos</span> </div></td>
</tr>
</table>
<hr>
<h1 align="center">Buscar</h1>
<form action="datos_socios.php" method="get" name="form1" target="Socio:">
<table width="40%" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="15%"><div align="center"><strong>Socio:</strong></div></td>
<td width="85%"><label>
<input name="valorsocio" type="text" id="nombebida2" size="31">
</label></td>
</tr>
<tr>
<td height="27" colspan="2"><div align="center">
<input name="tipobusqueda" type="radio" value="codigo" checked>
Codigo
<label>
<input name="tipobusqueda" type="radio" value="nombre">
</label>
Nombre </div> <div align="center"></div></td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<label>
<input name="Submit" type="submit" id="Submit" value="Enviar dato">
</label>
</div></td></tr>
</table>
</form>
<hr>
</body>
</html>


Y UNA PAGINA DONDE SE MUESTRA Y SE PROCESA:

datos_socios.php

<?php
session_start();
if($_SESSION['nivel']==1){
}else{
//header("Location: bebidas.php?error=No tiene acceso al club de socios");
}
?>
<? include("../conexion.php");?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="69%" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td><div align="center"><a href="socios.php">Agregar socio </a> | <a href="buscar_socio.php">Modificar datos</a> </div></td>
</tr>
</table>
<hr>
<?php
$valorsocio=$_GET['valorsocio'];
$tipobusqueda=$_GET['tipobusqueda'];
$link=Conectarse();
if ($_GET['tipobusqueda'] == "codigo"){
$datos_socio = mysql_query("SELECT textsocio,codsocio,nombsocio,appatsocio,apmatsocio FROM socios WHERE codsocio='$valorsocio'",$link); ?>
<?php while($row=mysql_fetch_array($datos_socio)){ ?>
<table width="100%" border="1" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="26%"><div align="center" class="Estilo1 ">
<h3><u>CODIGO</u></h3>
</div></td>
<td width="74%"><input name="hiddenField6" type="hidden" value="<?php echo $row[0] ?>"> <input name="hiddenField32" type="hidden" value="<?php echo $row[1] ?>"></td>
</tr>
<form name="form1" method="get" action="actualizar_socio.php">
<tr>
<td height="48"><div align="center">
<label> </label>
<div align="center" class="Estilo1">
<h3><u>NOMBRE</u></h3>
</div>
<label> </label>
</div></td>
<td>
<div align="left">
<label>
<input name="hiddenField2" type="hidden" value="<?php echo $row[2] ?>">
<input name="hiddenField4" type="hidden" value="<?php echo $row[3] ?>">
<input name="hiddenField5" type="hidden" value="<?php echo $row[4] ?>">
</label>
</div></td>
</tr>
<tr>
<td height="48"><div align="center">
<h3 class="Estilo2">
<label> <u><em><strong>MODIFICAR DATOS:</strong></em></u> </label>
</h3>
</div></td>
<td><div align="center">
<label> </label>
</div>

<div align="center">
<label>
<input name="codsocio" type="hidden" id="codsocio">
| <a href="actualizar_socio_personales.php">Personales</a> | <a href="actualizar_socio_domicilio.php">Domicilio</a> | <a href="actualizar_socio_generales.php">Generales</a> | <a href="actualizar_socio_preferencias.php">Preferenc ias</a> | <a href="actualizar_socio_envios.php">Envios</a> | <a href="actualizar_socio_observaciones.php">Observac iones</a> | ELIMINAR </label>
</div>
<div align="center"></div></td>
</tr>
</form>
<? } mysql_close($link)?>
</table>
<?php }elseif ($_GET['tipobusqueda'] == "nombre"){
$datos_socio = mysql_query("SELECT textsocio,codsocio,nombsocio,appatsocio,apmatsocio FROM socios WHERE nombsocio like '%$valorsocio%' or apmatsocio like '%$valorsocio%' or apmatsocio like '%$valorsocio%'",$link); ?>
<?php while($row=mysql_fetch_array($datos_socio)){ ?>
<table width="100%" border="1" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="26%"><div align="center" class="Estilo1 ">
<h3><u>CODIGO</u></h3>
</div></td>
<td width="74%"><input name="hiddenField" type="hidden" value="<?php echo $row[0] ?>">
<input name="hiddenField3" type="hidden" value="<?php echo $row[1] ?>"></td>
</tr>
<tr>
<td height="48"><div align="center">
<label> </label>
<div align="center" class="Estilo1">
<h3><u>NOMBRE</u></h3>
</div>
<label> </label>
</div></td>
<td>
<div align="left">
<label>
<input name="hiddenField2" type="hidden" value="<?php echo $row[2] ?>">
<input name="hiddenField4" type="hidden" value="<?php echo $row[3] ?>">
<input name="hiddenField5" type="hidden" value="<?php echo $row[4] ?>">
</label>
</div></td>
</tr>
<tr>
<td height="48"><div align="center">
<h3 class="Estilo2">
<label> <u><em><strong>MODIFICAR DATOS:</strong></em></u> </label>
</h3>
</div></td>
<td><div align="center">
<label> </label>
</div>

<div align="center">
<label>
<input name="codsocio" type="hidden" id="codsocio22">
| <a href="actualizar_socio_personales.php">Personales</a> | <a href="actualizar_socio_domicilio.php">Domicilio</a> | <a href="actualizar_socio_generales.php">Generales</a> | <a href="actualizar_socio_preferencias.php">Preferenc ias</a> | <a href="actualizar_socio_envios.php">Envios</a> | <a href="actualizar_socio_observaciones.php">Observac iones</a> | ELIMINAR </label>
</div>
<div align="center"></div></td>
</tr>
<? } mysql_close($link)?>
</table>
<?php }?>


<hr>
</body>
</html>


PORQUE NO MUESTRA LAS TABLAS? NO ESTA RECOGIENDO LOS VALORES ENTONCES?...

EN LA PAGINA BUSQUEDA LOS RADIOBUTTONS TIEnES VALORES: CODIGO Y NOMBRE Y NOMBRE: TIPOBUSQUEDA... Y LA CAJA DE TEXTO: VALORSOCIO... AYUDENME!

Última edición por yairo_gioel; 23/01/2008 a las 16:43 Razón: Error de redaccion