Buongiorno,
ho un problema con il seguente codice:
il codice non entra nel secondo if ($result->num_rows > 0){Codice:<?php include 'menu.html'; ?> <!DOCTYPE html> <html> <head> <title> Componente/Prodotto</title> </head> <body style="margin:0;"> <div id="header" align=center> <font color="black"> <h2>Componente/Prodotto</h2> </div> <div class="container-fluid"> <table id="example" class="display nowrap" cellspacing="0" width="100%"> <thead> <tr> <!--th>id</th--> <th>Prodotto</th> <th>Descrizione prodotto</th> <th>Codice</th> <th>Descrizione</th> <th>Quantità</th> </tr> </thead> <tfoot> <tr> <th>Prodotto</th> <th>Descrizione prodotto</th> <th>Codice</th> <th>Descrizione</th> <th>Quantità</th> </tr> </tfoot> <tbody> <?php $sql1 = "SELECT id, dist_base, descrizione FROM elenco_dist_base"; $result1 = $conn->query($sql1); if ($result1->num_rows > 0) { // output data of each row1 while($row1 = $result1->fetch_assoc()) { $id = $row1['id']; $dist_base = $row1['dist_base']; $descr_dist_base = $row1['descrizione']; $sql = "SELECT id, pn_utterson, description, quantity FROM $dist_base ORDER BY pn_utterson"; $result = $conn->query($sql); if ($result->num_rows > 0) { echo '<script language="javascript">alert("sono dentro l if")</script>'; // output data of each row while($row = $result->fetch_assoc()) { $id = $row['id']; $pn_utterson = $row['pn_utterson']; $descrizione = $row['description']; $quantita = $row['quantity']; echo "<tr>"; //echo "<td>" .$id ."</td>"; echo "<td>" .$dist_base ."</td>"; echo "<td>" .wordwrap($descr_dist_base, 35, "<br />", true) ."</td>"; echo "<td>" .$pn_utterson ."</td>"; echo "<td>" .wordwrap($descrizione, 35, "<br />", true) ."</td>"; echo "<td>" .$quantita ."</td>"; echo "</tr>"; } } echo '<script language="javascript">alert("sono fuori")</script>'; } } ?> </tbody> </table> </div> </body> </html>
e quindi mostra la tabella priva di dati.
Il suddetto codice funziona perfettamente in locale con Xampp

8Likes
LinkBack URL
About LinkBacks
