Código PHP:
$resultado=$mysqli->query($query);
Código PHP:
<?php
include('conexion.php');
$desde = $_POST['desde'];
$hasta = $_POST['hasta'];
//COMPROBAMOS QUE LAS FECHAS EXISTAN
if(isset($desde)==false){
$desde = $hasta;
}
if(isset($hasta)==false){
$hasta = $desde;
}
//EJECUTAMOS LA CONSULTA DE BUSQUEDA
$registro="SELECT * FROM productos WHERE fecha_reg BETWEEN '$desde' AND '$hasta' ORDER BY id_prod ASC";
$resultado=$mysqli->query($query);
//CREAMOS NUESTRA VISTA Y LA DEVOLVEMOS AL AJAX
echo '<table class="table table-striped table-condensed table-hover">
<tr>
<th width="300">Nombre</th>
<th width="200">Tipo</th>
<th width="150">Precio Unitario</th>
<th width="150">Precio Distribuidor</th>
<th width="150">Fecha Registro</th>
<th width="50">Opciones</th>
</tr>';
/**if($resultado>0){*/
if($resultado>0){
/*<?php while($row=$resultado->fetch_assoc()){ ?>
*/
while($registro2 = mysql_fetch_array($resultado)){
echo '<tr>
<td>'.$registro2['nomb_prod'].'</td>
<td>'.$registro2['tipo_prod'].'</td>
<td>S/. '.$registro2['precio_unit'].'</td>
<td>S/. '.$registro2['precio_dist'].'</td>
<td>'.fechaNormal($registro2['fecha_reg']).'</td>
<td><a href="javascript:editarProducto('.$registro2['id_prod'].');" class="glyphicon glyphicon-edit"></a> <a href="javascript:eliminarProducto('.$registro2['id_prod'].');" class="glyphicon glyphicon-remove-circle"></a></td>
</tr>';a
}
}else{
echo '<tr>
<td colspan="6">No se encontraron resultados</td>
</tr>';
}
echo '</table>';
?>