
03/06/2013, 22:11
|
| | Fecha de Ingreso: marzo-2011 Ubicación: Palmira
Mensajes: 7
Antigüedad: 14 años Puntos: 0 | |
4 Consultas, una no anda que es un combo <?php
$bandera = $_REQUEST["bandera"];
if ($_REQUEST["bandera"] ==1)
{
$id_docente = $_REQUEST["id_docente"];
$ape_doc = $_REQUEST["ape_doc"];
$dni_doc = $_REQUEST["dni_doc"];
$fecnac_doc=$_REQUEST["fecnac_doc"];
$opcion=$_REQUEST["opcion"];
;
////////////////////////////////////////////////////
//Convierte fecha de normal a mysql
////////////////////////////////////////////////////
function cambia_a_mysql($fecha){
ereg( "([0-9]{1,2})/([0-9]{1,2})/([0-9]{2,4})", $fecha, $mifecha);
$lafecha=$mifecha[3]."-".$mifecha[2]."-".$mifecha[1];
return $lafecha;
}
////////////////////////////////////////////////////
//Convierte fecha de mysql a normal
////////////////////////////////////////////////////
function cambia_a_normal($fecha){
ereg( "([0-9]{2,4})-([0-9]{1,2})-([0-9]{1,2})", $fecha, $mifecha);
$lafecha=$mifecha[3]."/".$mifecha[2]."/".$mifecha[1];
return $lafecha;
}
$fecnac_doc_db=cambia_a_mysql("$fecnac_doc");
$con= mysql_connect("localhost","root","localhost")
or die ("no se puede conectar con el servidor");
//echo "El usuario se ha conectado con el servidor localhost";
$resp= mysql_select_db("roca")
or die ("<br>no se puede seleccionar la base de datos");
//echo "<br>";
$sql="select a.id_docente,a.ape_doc,a.nom_doc,a.dni_doc,a.cuil_ doc,a.fecnac_doc,a.dom_doc,a.select1,a.select2,a.s elect3,a.telf_doc,a.telc_doc,l.id,l.opcion,d.id,d. opcion,p.id,p.opcion from docente as a, select_3 as l, select_2 as d, select_1 as p where a.select3=l.id and a.select2=d.id and a.select1=p.id" ;
if ($id_docente != "")
{
$sql .= " and id_docente=" . $id_docente;
}
if ($ape_doc != "")
{
$sql .= " and ape_doc like '%" .trim($ape_doc) . "%' ";
}
if ($dni_doc != "")
{
$sql .= " and dni_doc like '%" .($dni_doc) . "%' ";
}
if ($opcion != "")
{
$sql .= " and opcion like '%" .trim($opcion) . "%' ";
}
$result_doc = mysql_query($sql);
}
else
{
//echo "vacio";
}
?>
<!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=iso-8859-1" />
<title>Documento sin título</title>
<style type="text/css">
<!--
.Estilo1 { font-size: 24px;
color: #FFFFFF;
}
.Estilo2 { font-size: 16px;
color: #FFFFFF;
}
.Estilo3 {color: #FFFFFF}
.Estilo4 {
color: #006699
}
.Estilo9 {font-size: 16px}
-->
</style>
</head>
<script>
function consultar()
{
//alert("hola");
var id_docente= document.all.id_docente.value;
var ape_doc = document.all.ape_doc.value;
var dni_doc = document.all.dni_doc.value;
var opcion= document.all.opcion.value;
if (id_docente == "" && ape_doc == "" && dni_doc== "" && opcion == "" )
{
alert("Debe completar al menos un filtro de busqueda");
return;
}
document.location.href = "formconsulta de Docente.php?id_docente=" + id_docente + "&ape_doc=" + ape_doc + "&dni_doc=" + dni_doc + "&opcion =" + opcion + "&bandera=1";
}
function limpiar ()
{
document.all.id_docente.value="";
document.all.ape_doc.value="";
document.all.dni_doc.value="";
}
</script>
<body>
<table width="1220" height="86" border="0">
<tr>
<th width="70" height="82" align="left" scope="col"><img src="ESCUDO DE LA ROCA mediano.jpg" alt="" width="70" height="73" /></th>
<th width="1132" align="left" scope="col"><img src="barra roca.png" alt="" width="1135" height="74" /></th>
</tr>
</table>
<table width="1221" height="431" border="0">
<tr>
<td width="1214" align="center" valign="top" bgcolor="#006699"><fieldset>
<legend><span class="Estilo1">Formulario</span> </legend>
<form id="formconsulta de Docente" name="formconsulta de Docente" method="post" action="formconsulta de Docente">
<label><span class="Estilo2"><span class="Estilo4">11</span>Código</span>
<input name="id_docente" type="text" id="id_docente" />
<span class="Estilo4"> 11111</span> </label>
<span class="Estilo3">
<label> Apellido
<input name="ape_doc" type="text" id="ape_doc" />
<span class="Estilo4"> 11111</span> </label>
</span>
<label> </label>
<label><span class="Estilo3">DNI
<input name="dni_doc" type="text" id="dni_doc" maxlength="8" />
</span> </label>
<p><span class="Estilo3">
</span></p>
<table width="682" border="0">
<tr>
<td width="226"><span class="Estilo3">
<label>Localidad
<?
$con= mysql_connect("localhost","root","localhost")
or die ("no se puede conectar con el servidor");
//echo "El usuario se ha conectado con el servidor localhost";
$resp= mysql_select_db("roca")
or die ("<br>no se puede seleccionar la base de datos");
$query="select id,opcion from select_3";
$result=mysql_query($query);
echo "<select name=\"opcion\" >";
echo "<option>localidad</option>";
while ($row=mysql_fetch_array($result))
{
echo "<option name=\"opcion\" id=\"opcion\" size=\"10\" value=\"".$row["opcion"]."\">".$row["opcion"] ."</option>";
}
?>
</label>
<label><span class="Estilo6"></label>
</span></td>
<td width="206"> </td>
<td width="190"> </td>
</tr>
</table>
<p><span class="Estilo3">
<label></label>
</span></p>
</form>
<p>
<input name="Submit" type="button" class="Estilo9" value="Consultar" onclick='consultar()' />
<label></label>
<label>
<input name="formconsulta de Docente" type="button" class="Estilo9" value="Limpiar" onclick='limpiar()' />
</label>
</p>
<p>
<label></label>
<label></label>
<?php
if ($bandera == 1)
{
?>
<label></label>
</p>
<table align="center" border="0" cellpadding="1" cellspacing="1" width="99%" height="104" rowspan="1" bgcolor="#FDFDFD">
<tr align=center>
<td></td><td></td>
<td height="23" colspan=9><b>DATOS DEL DOCENTE</b></td>
<tr>
<td width=67 valign="middle" bgcolor="#999999"> <center><b>CODIGO</b></center></td>
<td width=84 valign="middle" bgcolor="#999999"> <center><b>APELLIDO</b></center></td>
<td width=76 valign="middle" bgcolor="#999999"> <center><b>NOMBRE</b></center></td>
<td width=32 valign="middle" bgcolor="#999999"> <center>
<b>DNI</b>
</center></td>
<td width=39 valign="middle" bgcolor="#999999"> <center><b>CUIL</b></center></td>
<td width=144 valign="middle" bgcolor="#999999"> <center><b>FECHA DE NAC.</b></center></td>
<td width=95 valign="middle" bgcolor="#999999"> <center><b>DOMICILIO</b></center></td>
<td width=60 valign="middle" bgcolor="#999999"> <center><b>LOCAL.</b></center></td>
<td width=59 valign="middle" bgcolor="#999999"> <center><b>DEPTO.</b></center></td>
<td width=56 valign="middle" bgcolor="#999999"> <center><b>PROVI.</b></center></td>
<td width="72" valign="middle" bgcolor="#999999"><center>
<b>TEL.FIJO</b>
</center></td>
<td width="72" valign="middle" bgcolor="#999999"><center>
<b>TEL.CEL.</b>
</center></td>
</tr>
<?PHP
if(mysql_num_rows($result_doc) == 0 )
{
//echo "hola";
die;
?>
<TABLE align=center border=0 >
<TR ALIGN="CENTER">
<TD colspan="7"><b>NO SE HA ENCONTRADO REGISTROS PARA LOS FILTROS SELECCIONADOS!!!</b></TD>
</TR>
</TABLE>
<?php
}
?>
<?php
while ($row_doc = mysql_fetch_row($result_doc)) {
?>
<tr>
<td height="23" align="center" bgcolor="#CCCCCC"><?php echo $row_doc[0] ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo $row_doc[1] ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo $row_doc[2] ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo $row_doc[3] ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo $row_doc[4] ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo $row_doc[5] ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo $row_doc[6] ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo $row_doc[13] ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo $row_doc[15] ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo $row_doc[17] ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo $row_doc[10] ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo $row_doc[11] ?></td>
</tr>
<?PHP
}
}
?>
</TABLE>
<tr>
<td> </td>
<td width="10"> </td> |