jquery - Very similar PHP code in two pages, one works, the other won't -


i'm building restaurant table-management system in php using bootstrap, jquery , mysqli. problem can't seem display query results on page despite code being very, similar in both, can please explain i'm missing please? full code of site far (site in spanish):

<!doctype html> <head>     <title>postodoro</title>      <meta name="viewport" content="width=device-width, initial-scale=1">      <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" type="text/css" media="screen" />     <link rel="stylesheet" href="style/style.css" type="text/css" media="screen" />     <script language="javascript" type="text/javascript" src="scripts/jquery-2.1.4.min.js"></script>     <script language="javascript" type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>     <script language="javascript" type="text/javascript" src="scripts/script.js"></script> </head><body> <div class="container-fluid">       <?php      /**************************************************/      //          crea conexión base de datos.        //     /**************************************************/       function connect(){         $c = mysqli_connect("localhost","root","root","database");                 // check connection         if (mysqli_connect_errno()) {   // si hay error lo menciona en alerta.             echo '<div class="alert alert-danger">';             echo 'failed connect mysql: ' . mysqli_connect_error();             echo '</div>';         } else {             // en caso de éxito (placeholder).         }     }        connect();     ?>      <!--/**********************************************/      //          barra de menú.                        //     /************************************************-->      <div class="row">         <div class="col-xs-3">             <button type="button" class="btn btn-lg btn-default" id="showplaces">mesas</button>         </div>         <div class="col-xs-3">             <button type="button" class="btn btn-lg btn-default" id="showplaces">clientes</button>         </div>         <div class="col-xs-3">             <button type="button" class="btn btn-lg btn-default" id="showplaces">cuentas</button>         </div>         <div class="col-xs-3">             <button type="button" class="btn btn-lg btn-default" id="showplaces">personal</button>         </div>     </div>     <div class="row">         <div class="col-lg-12">             <table class="table-striped">                 <caption>mesas</caption>                 <thead>                     <tr>                         <th>nombre</th><th>piso</th><th>cliente</th><th>mesero</th><th>area</th>                     </tr>                 </thead>                 <tbody>                     <?php                      $result = mysqli_query($c,"select * places");                     echo "bp1";                     while ($places = mysqli_fetch_array($result)) {                         echo "bp2";                         echo "<td>". $places ['name']."</td>";                         echo "<td>". $places ['floor']."</td>";                         echo "<td>". $places ['customer']."</td>";                         echo "<td>". $places ['waiter']."</td>";                         echo "<td>". $places ['area']."</td>";                          echo "</tr>";                     }                     mysqli_free_result($result);                     ?>                   </tbody>             </table>         </div>     </div>         </div> <?php mysqli_close($c); ?> </body> </html> 

variables echoes "bp1" , "bp2" debugging purpuses (how debug php anyway?), bp1 gets printed on page, bp2 won't. means while cicle not getting executed, cause? it's pretty simple query. took of code old school excercice, , work:

<?php         $result = mysqli_query($connection,"select * students");          while($row = mysqli_fetch_array($result)) {             echo "<tr>";             echo "<td>" . $row['nombre'] . "</td>";             echo "<td>" . $row['calif'] . "</td>";             echo "</tr>";         }         mysqli_close($connection);         ?> 

thanks help! right place ask such simple questions?

  • little clarification, problem table query results not apearing on page.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -