When uploading to the server there is a query that does not work

0

I was working on a web site, now I upload it to the server because the programs that I have left need this upload on the server. When uploading it to the client's server, everything works perfectly, except for a page that does not load querys. The good thing is that if I upload it to my server if everything works correctly, then I do not know what it can be, I upload the code that I think fails if you see any anomaly.

<?php include "conexion/conexion.php" ?>

<?php include ("includes/nav.php")?>
   <div class="container">
      <div class="row justify-content-center">
         <div class="col-12" style="z-index:2;">
           <h4 class="tituEquip" id="TituPorque">Depilación Depildiodo</h4>
           <h2 class="padBtonConoce tituEquip" id="TituPorque2">¿Que tipo de equipo necesitas? </h2>
           <a href="#" id="botonPorque" class="btonConoce toc">¿Por qué tener Depilación Láser en mi centro?</a>
          </div>
         </div>
      </div>
    </div>


<div class="col-12 padLosEquipos">
  <div class="container">
    <div class="row">
      <div class="col-7 txt7">
        <h3>Consigue evolucionar tu negocio</h3>
        <h5>en tan sólo 4 pasos</h5>
        <p>Consigue más clientes para tu centro durante todo el año 
           <strong>(incluso en verano)</strong>. Descubre las ventajas del equipo más recomendado para la depilación por la comunidad científica. 
        </p>
      </div>
      <div class="col-1"></div>
      <div class="col-4">
        <div class="detall22"><i class="fas fa-thumbs-up falista2259"></i> Trabaja también en verano</div>
        <div class="detall22"><i class="fas fa-thumbs-up falista2259" style="animation-delay: 0.5s;" ></i> Cualquier fototipo de piel</div>
        <div class="detall22"><i class="fas fa-thumbs-up falista2259" style="animation-delay: 0.7s;" ></i> Servicio técnico</div>
        <div class="detall22"><i class="fas fa-thumbs-up falista2259" style="animation-delay: 0.9s;" ></i> Soporte formativo</div>
        <!--<div class="detall22"><i class="fas fa-thumbs-up falista2259"></i> Formación incluida</div>-->
        </div>
       </div>
      </div>
     </div>

This is where I think it fails, because one of the errors is that it does not load the image.

<div class="col-12 PdPnn corrigPadfff">
  <div class="container">
     <div class="row">

      <?php
       //var_dump($_GET);
       $result = $mysqli->query("SELECT * FROM productos 
                                 WHERE estado = 1");
       mysqli_set_charset("utf8");

       //resultado del query
       $result;
       //variable de control
       $variablecontrol = 0;
        foreach ($result as $itemregistro){
            if ($variablecontrol%2==0){
       ?>
       <div id="Norecomen" class="col-4">
       <div id="boxicing2" class="mod-maqLos" style="margin-bottom: 0px;">
       <div style="position: relative;">
          <div class="titulosPOs">
             <h5><?php echo $itemregistro['producto']; ?></h5>
             <h2 class="chaDos"><?php echo $itemregistro['alias']; ?></h2>
             <img src="images/maquinas/<?php echo $itemregistro['imagen']; ?>" alt="" id="imGDio" class="iMgDiod">
          </div>
          <div class="row margBOO">
            <div class="col-6">
            <div id="nAlquilar" class="col-6 pvp" style="padding-left: 0px;">435<small>€/mes</small><div class="desdesmall LEft">desde</div><div class="siniva" style="width: 100%;">Precio sin IVA</div></div>
          </div>
          <div class="col-6"><a href="equipos.php?ID=1" class="btn btn-primary bonton-info ">ME INTERESA</a></div>
          </div>
         </div>
        </div>
      </div>
     <?php } else{ ?>

     <div id="recomendado" class="col-8">
       <div id="boxicing1"  class="mod-maqLos2" >
         <div style="position: relative;">
            <div class="titulosPOs1">                        
              <?php $it= $itemregistro['id']; ?>

              <h5><?php echo $itemregistro['producto']; ?><p class="pLab">¡ EL + ALQUILADO !</p></h5>
              <h2 class="dualwavefont cahDoa"><?php echo $itemregistro['alias']; ?></h2>

              <div class="row GmBton">
                <div class="col-6">
                  <div class="paDEspec">
              <?php
              $resultas = $mysqli->query("SELECT * FROM checks 
                                       WHERE IDproducto = $it");
              mysqli_set_charset("utf8");
              while($resa = $resultas->fetch_array()) {
              ?>               
              <div class="fetAlla"><i class="fas fa-check-circle fastRer"></i> <?php echo $resa['titulo']; ?></div>                 
              <?php } ?>
             </div>
            </div>
            <div class="col-6">
               <img src="images/maquinas/<?php echo $itemregistro['imagen']; ?>" alt="" id="imgDual" class="imgDUal">
            </div>
           </div>
         </div>
            <div class="row margBOO">
               <div class="col-6">
               <div id="nAlquilar" class="col-6 pvp" style="padding-left: 0px;">455<small>€/mes</small><div class="desdesmall LEft">desde</div><div class="siniva" style="width: 100%;">Precio sin IVA</div></div>
            </div>
            <div class="col-6"><a href="equipos.php?ID=2" class="btn btn-primary bonton-info ">ME INTERESA</a></div>
            </div>
           </div>
         </div>
       </div>

        <?php
              }
             $variablecontrol++;
          }
        ?>
            </div>
        </div>
      </div>
    
asked by Miguel 28.09.2018 в 07:33
source

1 answer

1

You still need to bring the results to the array format with fetch_array() , as you do when you bring the result query.

$results= $results->fetch_array();

I edit your answer to show the final solution!

We just change this:

foreach ($result as $itemregistro){

For this other:

while ($res = $result->fetch_array()) {

I guess so I talk to @Javi will be for the PHP versions

    
answered by 28.09.2018 / 08:17
source