Código:
Muchas gracias desde ya y saludos! <div class="bodycont"> <table class="tabla" width="80%" align="center" border="2" cellspacing="0" cellpadding="2"> <tr> <th class="auto-style3" colspan=10> INDICE DE IMPRESORAS </th> <tr> <th class="auto-style2" rowspan=3>IMPRESORAS</th> <th class="auto-style2" rowspan=3>IP</th> <th class="auto-style2" colspan=8> INSUMOS </th> <tr> <th class="auto-style2" colspan=2> CNEGRO </th> <th class="auto-style2" colspan=2> CCYAN </th> <th class="auto-style2" colspan=2> CMAGENTA </th> <th class="auto-style2" colspan=2> CAMARILLO </th> <tr> <th class="auto-style2">CANTIDAD</th> <th class="auto-style2"> PEDIDOS </th> <th class="auto-style2">CANTIDAD</th> <th class="auto-style2"> PEDIDOS </th> <th class="auto-style2">CANTIDAD</th> <th class="auto-style2"> PEDIDOS </th> <th class="auto-style2">CANTIDAD</th> <th class="auto-style2"> PEDIDOS </th> </tr> <?php $selector = mysql_query("SELECT * FROM indeximpresoras"); while ($rowW = mysql_fetch_array($selector)){ $idemp1 = $rowW["idemp1"]; $imprpre = $idemp1+1; $impr = "impresora".$imprpre; echo $impr; } /* Realizamos la consulta SQL */ $sql="select * from $impr"; $result= mysql_query($sql) or die(mysql_error()); // CONECTARME PARA SUMAR 1 $query = "SELECT SUM(Cant) FROM $impr"; $resul = mysql_query($query) or die(mysql_error()); // MOSTRAR SUMA CANTIDAD STOCK while($row = mysql_fetch_array($resul)){ $sumnegro = $row['SUM(Cant)'] ; } // CONECTARME PARA SUMAR $query2 = "SELECT SUM(Pedidoscant) FROM $impr"; $resul2 = mysql_query($query2) or die(mysql_error()); // MOSTRAR SUMA CANTIDAD STOCK while($row = mysql_fetch_array($resul2)){ $sumnegrop = $row['SUM(Pedidoscant)'] ; } // CONECTARME PARA SUMAR 2 $query4 = "SELECT SUM(CantC) FROM $impr"; $resul4 = mysql_query($query4) or die(mysql_error()); // MOSTRAR SUMA CANTIDAD STOCK while($row = mysql_fetch_array($resul4)){ $sumcyan = $row['SUM(CantC)'] ; } // CONECTARME PARA SUMAR $query3 = "SELECT SUM(PedidoscantC) FROM $impr"; $resul3 = mysql_query($query3) or die(mysql_error()); // MOSTRAR SUMA CANTIDAD STOCK while($row = mysql_fetch_array($resul3)){ $sumcyanp = $row['SUM(PedidoscantC)'] ; } // CONECTARME PARA SUMAR 3 $query5 = "SELECT SUM(CantM) FROM $impr"; $resul5 = mysql_query($query5) or die(mysql_error()); // MOSTRAR SUMA CANTIDAD STOCK while($row = mysql_fetch_array($resul5)){ $summag = $row['SUM(CantM)'] ; } // CONECTARME PARA SUMAR $query6 = "SELECT SUM(PedidoscantM) FROM $impr"; $resul6 = mysql_query($query6) or die(mysql_error()); // MOSTRAR SUMA CANTIDAD STOCK while($row = mysql_fetch_array($resul6)){ $summagp = $row['SUM(PedidoscantM)'] ; } // CONECTARME PARA SUMAR 4 $query7 = "SELECT SUM(CantA) FROM $impr"; $resul7 = mysql_query($query7) or die(mysql_error()); // MOSTRAR SUMA CANTIDAD STOCK while($row = mysql_fetch_array($resul7)){ $sumama = $row['SUM(CantA)'] ; } // CONECTARME PARA SUMAR $query8 = "SELECT SUM(Pedidoscant) FROM $impr"; $query9 = "SELECT SUM(PedidoscantA) FROM $impr"; $resul8 = mysql_query($query9) or die(mysql_error()); // MOSTRAR SUMA CANTIDAD STOCK while($row = mysql_fetch_array($resul8)){ $sumamap = $row['SUM(PedidoscantA)'] ; } ?> <?php while ($rsEmp = mysql_fetch_assoc($queEmp)) { ?> <tr class="auto-style4"> <td ><?php echo $rsEmp['IMPRESORAS']; ?></td> <td href="http://<?php echo $rsEmp['IP']; ?>"><?php echo $rsEmp['IP']; ?></td> <?php $resul11 = mysql_query($query) or die(mysql_error()); ?> <?php $resul10 = mysql_query($query8) or die(mysql_error()); ?> <?php $resul12 = mysql_query($query4) or die(mysql_error()); ?> <?php $resul13 = mysql_query($query3) or die(mysql_error()); ?> <?php $resul14 = mysql_query($query5) or die(mysql_error()); ?> <?php $resul15 = mysql_query($query6) or die(mysql_error()); ?> <?php $resul16 = mysql_query($query7) or die(mysql_error()); ?> <?php $resul17 = mysql_query($query9) or die(mysql_error()); ?> <?php while($row = mysql_fetch_array($resul11)){ ?> <td ><?php echo $row['SUM(Cant)']; ?></td> <?php while($row = mysql_fetch_array($resul10)){ ?> <td ><?php echo $row['SUM(Pedidoscant)']; ?></td> <?php while($row = mysql_fetch_array($resul12)){ ?> <td ><?php echo $row['SUM(CantC)']; ?></td> <?php while($row = mysql_fetch_array($resul13)){ ?> <td ><?php echo $row['SUM(PedidoscantC)']; ?></td> <?php while($row = mysql_fetch_array($resul14)){ ?> <td ><?php echo $row['SUM(CantM)']; ?></td> <?php while($row = mysql_fetch_array($resul15)){ ?> <td ><?php echo $row['SUM(PedidoscantM)']; ?></td> <?php while($row = mysql_fetch_array($resul16)){ ?> <td ><?php echo $row['SUM(CantA)']; ?></td> <?php while($row = mysql_fetch_array($resul17)){ ?> <td ><?php echo $row['SUM(PedidoscantA)']; ?></td> </tr> <?php } ?> <?php } ?> <?php } ?> <?php } ?> <?php } ?> <?php } ?> <?php } ?> <?php } ?> <?php } ?> </table> </div>