My dynamically generated table is ordered with the tablesorter-master plugin while a normal table does

0
<head>
  <script type="text/javascript" src="php/tablesorter-master/jquery-latest.js"></script>
  <script type="text/javascript" src="php/tablesorter-master/jquery.tablesorter.min.js"></script>
  <script type="text/javascript">
  $(document).ready(function() {
      $("#tabla").tablesorter({ sortList: [[0,0], [1,0]] });
  });
  </script>
</head>
<body>
<table cellspacing="0" cellpadding="0" id="tabla" class="tabla">
  <thead>
    <tr>
      <th><span>Nombre</span></th>
      <th><span>Apellidos</span></th>
      <th><span>Edad</span></th>
      <th><span>Profesión</span></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td class="align-left">Perico</td>
      <td>Lopez Pérez</td>
      <td>33</td>
      <td>Diseñador</td>
    </tr>
    <tr>
      <td class="align-left">Marta</td>
      <td>Giner De Los Rios</td>
      <td>18</td>
      <td>Social Media</td>
    </tr>
    <tr>
      <td class="align-left">Lucia</td>
      <td>Díez Suaréz</td>
      <td>45</td>
      <td>Diseñador</td>
    </tr>
    <tr>
      <td class="align-left">Pepe</td>
      <td>Campos Casal</td>
      <td>19</td>
      <td>Programador</td>
    </tr>
    <tr>
      <td class="align-left">Raúl</td>
      <td>Gonzalez Castro</td>
      <td>43</td>
      <td>Comercial</td>
    </tr>
    <tr>
      <td class="align-left">Susana</td>
      <td>Díaz Pino</td>
      <td>33</td>
      <td>Social Media</td>
    </tr>
  </tbody>
</table>

<?php include "php/tabla.php"; ?>
</body>

Here starts the second code that is the dynamically generated table:

<?php

include "conexion.php";

$user_id=null;
$sql1= "select * from propiedades";
$query = $con->query($sql1);
?>

<?php if($query->num_rows>0):?>



    <table  id="tabla" class='table'>
<thead>
            <tr>
                <th><span>Nombre</span></th>
                <th>Area</th>

                <th>Departamento</th>

                <th>P. Total</th>

            </tr>
</thead><tbody>
<?php while ($r=$query->fetch_array()):?>


<tr>

            <td style="color:cornflowerblue;" scope="row"><a target='_top' href="php/reporte.php?id=<?php echo $r["id_propiead"];?>"</a><?php echo $r["nombre_p"]; ?></td>
            <td><?php echo $r["area_p"]; ?> Mz </td>

            <td><?php echo  $r["departamento_p"];  ?></td>

            <td><?php echo $r["precio_p"]?></td>

</tr>
<?php endwhile;?>


</tbody>
</table>
<?php else:?>
    <p class="alert alert-warning">No hay resultados</p>
<?php endif;?>
    
asked by Eros García 05.07.2018 в 06:34
source

0 answers