Php statement meets but does not show results

0

this is my php code:

 <?php

    require_once "conexion.php";
    $conexion=conexion();

    $n= isset($_POST['nombre']) ? $_POST['nombre'] : null ;

    $sql="SELECT id_habitacion, numero, nombre_categoria, estado_habitacion
            FROM habitaciones WHERE nombre_categoria LIKE '$n'";




    $result=mysqli_query($conexion, $sql);



    while($habitaciones=mysqli_fetch_row($result)){
        $id=$habitaciones[0];
        $estado=$habitaciones[3];




?>
<div class="boton">
    <a href="#ventana3" data-toggle="modal"><img src="cama1.png" width="150px" height="150px" onclick="Editar('<?php echo $id?>')"></a>
</div>

<?php

}
?>

it turns out that a variable ($ n) arrives where it meets the query sql (where category_name LIKE '$ n'), it should show me a "list" with all the data that contain that specific name, the problem is that placing it like this does not show anything on the page, but if I put an inspect in the console section it shows me the code:

   <div class="boton">
    <a href="#ventana3" data-toggle="modal"><img src="cama1.png" 
    width="150px" height="150px" onclick="Editar('<?php echo $id?>')"></a>
   </div>

but the screen does not show me the image, the point is that if I change the where category_name LIKE '$ n' by where category_name LIKE 'Premium', if I show the images.

Corroborate the data sent, up to the sql statement and this correct arrives the corresponding value but does not show anything, any suggestions?

This photo shows what I want by placing it where "Premium": link

and this picture what I do if I put the where with parameter "$ n":

link

    
asked by oscar edu 05.06.2018 в 03:24
source

0 answers