<?php
session_start();
require_once('../conexion.php');
require_once('../include/sesiones.php');
$variable=trim($_REQUEST['nombrecliente']);
if(empty($variable))
{
    echo "Debe especificar un valor";
}
else 
{
    $query=mysqli_query($con,"SELECT * from cliente where (clie_nombre like '%$variable%' OR clie_cc like '%$variable%') and empresa='$empresa' LIMIT 20") or die(mysqli_error($con));
    $numero = mysqli_num_rows($query);
    if($numero>0)
    {
        echo "<div class='modal-body'><div class='table-responsive'>
        <table id='table' class='table table-striped table-bordered'>
            <tr>
                <th>CC</th>
                <th>NOMBRE</th>
                <th>DIRECCION</th>
                <th>BARRIO</th>
                <th></th>
            </tr>";
        while($rowb=mysqli_fetch_array($query))
        {
?>
            <tr>
                <td ><?php echo $rowb["clie_cc"];?></td>
                <td ><?php echo $rowb["clie_nombre"];?></td>
                <td ><?php echo $rowb["clie_direccion"];?></td>
                <td ><?php echo $rowb["clie_barrio"];?></td>
                <td >
                    <a href="tienda_a_tienda/agregar_cliente.php?clie_id=<?php echo $rowb['clie_id']; ?>" title="Agregar" class="btn btn-xs btn-info"><i class="btn-icon-only icon-plus"></i></a>
                </td>
            </tr>
<?php 
        }
    echo "</table></div></div>";
    } 
    else 
    {
        echo "<div class='modal-body'><div class='table-responsive'>
            <table id='table' class='table table-striped table-bordered'>
                <tr>
                    <td colpans='3'>Sin Resultados</td>
                </tr>
        </table></div></div>";
    } 
} 
?>