Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/08/2016, 06:46
VR1387
 
Fecha de Ingreso: abril-2016
Mensajes: 19
Antigüedad: 8 años, 1 mes
Puntos: 0
Consulta sql por rango de fechas y cedula PHP MYSQL

Buenas amigos.

Tengo este codigo, le cual las consultas de las base de datos las hace sin problema.

Lo que quiero realizar es que pueda hacer una consulta por la cédula y de acuerdo al rango de fechas, seleccionado por el usuario.

Ojo manteniendo el mismo inner join en caso de poderse

Código:
<html>
<head>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/minified/jquery-ui.min.css" type="text/css" />

<title>Busqueda de  clientes</title>
	<link rel="stylesheet" type="text/css" href="css/default.css" />
</head>
<body>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.1/jquery-ui.min.js"></script>
<script>
$(function() {
    $( "#nombre" ).autocomplete({
        source: 'j2.php'
    });
});
</script>
<center>
<form action="buscarclientes.php" method="post">
<table border="2" bordercolor="#151515" bgcolor="#F7F8E0" width="600">
	<tr>
		<td width="150"><center>Nombre del empleado</center>
		</td>
		<td>
    	<input type="text" maxlength="9" id = "nombre" size="20"  name="nombre">
    	<input type="submit" name="buscar" value="Buscar">
		</td>
		<td>
		 Seleccionar Fecha:
	       	<input type="date" name="fecha_i" required="required" step="1" min="2013-01-01" max="2018-12-31" value="<?php echo date("Y-m-d");?>">
		</td>
				<td>
		<label> Seleccionar Fecha:</label>
			<input type="date" name="fecha_f" required="required" step="1" min="2013-01-01" max="2018-12-31" value="<?php echo date("Y-m-d");?>">
		</td>
	</tr>
</table>
</form>
		<input type="submit" name="regresar" value="Regresar al inicio" onclick="location='index.php'">
</center>
<?php
require "conexion.php";

if (isset($_POST['nombre'])) {
$nombre = $_POST['nombre'];
$queryconsulta = mysql_query("SELECT nombre, apellido, hora, fecha FROM tb_trab
							INNER JOIN tb_eventos on tb_trab.cedula = tb_eventos.cedula
							where tb_trab.cedula='$ced'",$con);



$mostrar='
<center>
<table border="2" bordercolor="#151515" bgcolor="#F7F8E0" width="600">
	<tbody>
		<tr>
			<td>Nombre</td>
			<td>Apellido</td>
			<td>Hora</td>
			<td>Fecha</td>
		</tr>
		<tr>
<center>';

	while($array=mysql_fetch_array($queryconsulta)){
	$nombre = "$array[nombre]";
	$apellido = "$array[apellido]";
	$hora = "$array[hora]";
	$fecha = "$array[fecha]";
		echo $mostrararray='
		<center>
		<table>
		<tr>
			<td><input type="text"  disabled size="" value="'.$nombre.'"></td>
			<td><input type="text"  disabled size="" value="'.$apellido.'"></td>
			<td><input type="text"  disabled size="" value="'.$hora.'"></td>
			<td><input type="text"  disabled size="" value="'.$fecha.'"></td>
		</tr>
		</tbody>
		</table>
		</center>';
	} // while

}
else
	echo "<center>Debe introducir una cedula</center>";

?>