PHP - php no imprime la tabla completa

 
Vista:

php no imprime la tabla completa

Publicado por Luis (2 intervenciones) el 09/07/2019 01:50:05
Hola!

antes de todo debo decir que soy principiante en esto...

Tengo una pagina hecha con HTML y dentro de su código agregué el PHP.
Quiero que al hacer clic en el botón de buscar se imprima una tabla con los datos que tengo en MySQL, pero en lugar de eso solo se imprime el borde de la tabla y nada mas.

la verdad no tengo idea de qué pueda estar pasando; agregué los estilos de la tabla directamente en el PHP. ¿será eso?

La parte de HTML la he llevado a cabo con Bootstrap studio.


Dejo mi código por si logran ver el error (espero sea entendible).

De antemano gracias!


______________Acá la forma en que se imprime mi código______________

https://ibb.co/QjGY19m


_______________Código ________________________


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<form method="POST" action="index.php"  style="border-style: hidden;">
    <div class="table-responsive table-borderless" style="width: 1239px;">
 
        <table class="table table-bordered">
            <thead>
                <tr>
                    <th style="font-size: 25PX;" colspan="5">buscar persona</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td style="font-size: 20px;width: 202;"><br><select style="border-radius: 10px;" name="buscar_idioma"><optgroup label="Idioma"><option value="12" selected="">Español</option><option value="13">This is item 2</option><option value="14">This is item 3</option></optgroup></select></td>
                    <td
                        style="font-size: 20px;"><br><select style="border-radius: 10px;" name="buscar_ciudad"><optgroup label="Ciudad"><option value="12" selected="">Miami</option><option value="13">Londres</option><option value="14">This is item 3</option></optgroup></select></td>
                        <td
                            style="font-size: 20px;margin-right: 0px;"><br><select style="border-radius: 10px;" name="buscar_horario"><optgroup label="Horario"><option value="12" selected="">Nocturno</option><option value="13">Diurrno</option><option value="14">This is item 3</option></optgroup></select></td>
                            <td
                                style="font-size: 20px;width: 271px;" colspan="2"><br><button class="btn btn-primary btn-sm" type="submit" style="border-radius: 10px;background-color: rgb(14,3,145);" name="btn1">Buscar</button></td>
                                <td style="font-size: 20px;width: 277px;" colspan="2"><br><input type="search" style="border-radius: 10px;" placeholder="Buscar"></td>
                </tr>
                <tr>
                    <td colspan="4" style="font-size: 25px;"><strong>CITY</strong></td>
                </tr>
            </tbody>
        </table>
 
    </div>
</form>
</section>
<section style="float: left;width: 846px;padding-left: 120px;padding-top: -2px;height: 1817px;">
    <div id="izquierdo" style="width: 718px;margin-right: 0px;">
        <div class="table-responsive table-bordered" style="border-radius: 20px;width: auto;background-size: auto;height: auto;">
 
 
        <?php
 
if(isset($_POST['btn1']))
{
  include("abrir_conexion.php");
 
    $buscar_ciudad = $_POST['buscar_ciudad']; //solo quiero que funcione con este ítem por ahora
 
    {
        $resultados = mysqli_query($conexion,"SELECT * FROM $tabla_db1 WHERE ciudad like'%$buscar_ciudad%'");
 
 
 
      while($consulta = mysqli_fetch_array($resultados))
 
 
 
      {
 
        echo
        "
        <div class=\"table-responsive table-bordered\" style=\"border-radius: 20px;width: auto;background-size: auto;height: auto;\">
        <table class=\"table table-bordered\">
                <thead>
                    <tr style=\"border-style: hidden;height: 48px;\">
                        <th style=\"border-style: hidden;width: 16px;\"></th>
                        <th style=\"width: 852px;background-size: auto;height: 48px;\" colspan=\"7\"></th>
                    </tr>
                </thead>
                <tbody>
                    <tr style=\"height: 27px;\">
                        <td style=\"border-style: hidden;\"></td>
                        <td class=\"text-justify\" style=\"border-radius: 20px;padding-right: 31px;width: 193px;padding-bottom: 12px;background-image: url(&quot;assets/img/guia1.jpg&quot;);background-repeat: round;height: 39px;max-height: 39px;\" rowspan=\"4\"></td>
                        <td rowspan=\"6\" style=\"border-style: hidden;\"></td>
                        <td colspan=\"7\" style=\"font-size: 20px;\"><strong>".$consulta['nombre']."</strong></td>
                    </tr>
                    <tr style=\"height: 48px;border-style: hidden;\">
                        <td></td>
                        <td style=\"border-style: hidden;\">******</td>
                        <td colspan=\"7\">(32) Opiniones</td>
                    </tr>
                    <tr>
                        <td style=\"border-style: hidden;\"></td>
                        <td><strong>Habla</strong></td>
                        <td><strong>De</strong></td>
                        <td><strong>Horas Guiadas</strong></td>
                    </tr>
                    <tr style=\"border-style: hidden;\">
                        <td></td>
                        <td>".$consulta['idioma']."</td>
                        <td>".$consulta['nacionalidad']."</td>
                        <td>1.000</td>
                    </tr>
                    <tr style=\"border-style: hidden;\">
                        <td style=\"border-style: hidden;\"></td>
                        <td style=\"font-size: 20px;padding: 0px;\"><br><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;".$consulta['valor']."</strong><br><br></td>
                        <td class=\"text-justify\" rowspan=\"2\" colspan=\"5\">".$consulta['descripcion']."</td>
                    </tr>
                    <tr style=\"border-style: hidden;\">
                        <td style=\"border-style: hidden;\"></td>
                        <td style=\"padding-left: 36px;\"><button class=\"btn btn-primary\" type=\"button\" style=\"background-color: #0e0391;\">Reservar guía</button></td>
                    </tr>
                </tbody>
            </table>
            </div>
      ";
      } 
    }

  include("cerrar_conexion.php");
}

?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Kathyu
Val: 1.802
Plata
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

php no imprime la tabla completa

Publicado por Kathyu (905 intervenciones) el 09/07/2019 16:43:52
Divida su código, una cosa es html y otra php. No los mezcle.

Su ciclo (foreach/while) debe encerrar solo el <tr> donde aparecerán los datos de la tabla, no toda la tabla en si.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
2
Comentar
Imágen de perfil de Felix
Val: 47
Ha disminuido su posición en 26 puestos en PHP (en relación al último mes)
Gráfica de PHP

php no imprime la tabla completa

Publicado por Felix (32 intervenciones) el 09/07/2019 19:37:08
Saludos!

Hazle caso a Kathyu!

De hecho todo el código dentro del echo que intenta imprimir tu tabla esta muy mal.

La practica correcta es que dentro de las comillas dobles del echo

1
echo " ";

siempre deben ir comillas simples

1
echo "<td style='color: black;'></td>";

Si estas aprendiendo es recomendable que leas mucho la documentación de PHP que es extensa y esta en español.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar