0

bueno estoy usando 000webhost para hostiar una pagina de pruebas que tengo pero hay una parte que no me carga , me marca el error de "Syntax error , unexpected EOD" que buscando dice que es por que algo no esta identado pero en visual estudio todo me sale bien identado ,me dice donde abre y donde cierra excepto cuando lo subo a la pagina por lo que lo empecé a subir por partes y me marca error cuando subo códigos usando el EOD como comentario extra en el hosting me pide quitar las comillas simples adentro del $row.

<?php 
include 'conexion.php';

function getpartes(){
  $mysqli = getConn();
  $id = $_POST['id'];
  $query = "SELECT * FROM `partes` WHERE `proveedor` = '$id'";
  $result = $mysqli->query($query);
  $videos = '<option value=""></option>';
  while($row = $result->fetch_array(MYSQLI_ASSOC)){

   $precio = number_format($row['precio'],2);
  $anual =$row['anual'];
  $volumen = $row['volumen'];
  $millon = 1000000;
  $miles = 999;
  $conversion ="";
  $conversion2 ="";
  $conv ="";
  $conv2 ="";
  
  if($anual >= $millon){
       $div1= $anual/1000000;
       $conversion =round($div1*10) /10;
      echo $conversion.="&nbsp;m";

     }elseif($anual>=$miles){
       $div2= $anual/1000;
       $conversion2 =round($div2*10) /10;
       echo $conversion2.="&nbsp;k";
     }else{
      echo $anual;
    }
    
      if($volumen >= $millon){
        $di1= $volumen/1000000;
        $conv =round($di1*10) /10;
        echo $conv.="&nbsp;m";

      }elseif($volumen>=$miles){
        $di2= $volumen/1000;
        $conv2 =round($di2*10) /10;
        echo $conv2.="&nbsp;k";
      }else{
        echo $volumen;
      }
      
      
$prov = <<<EOD
    <div class="caja_descripcion0">
      <input class="transparente" readonly=»readonly» type="text" id="pro" name="pro"
      value="$row[proveedor]">
   </div>
 
 EOD;

 $parte = <<<EOD
    <div class="caja_descripcion0">
      <input class="transparente" readonly=»readonly» type="text" id="parte" name="parte"
      value="$row[numeroparte]">
   </div>
 
 EOD;

  $descripcion = <<<EOD

  <div class="caja_descripcion10">
    <input readonly=»readonly» class="RespDesc" type="text" id="desc" name="desc" 
    value="$row[descripcion]">
  </div>

  EOD; 

  $precio2 = <<<EOD

  <div class="caja_descripcion20" type="number"> 
    <input readonly=»readonly» class="ResNum" type="text" id="price" name="price" 
    value="$&nbsp; $precio "> 
  </div> 
      
  EOD; 

  $yearly2 = <<<EOD

  <div class="caja_descripcion30" type="number"> 
    <input readonly=»readonly» class="ResAn" type="text" id="an" name="an" 
    value="$conversion $conversion2">&nbsp;
  </div>

  EOD;

  $volumen = <<<EOD

  <div class="caja_descripcion40">  
    <input readonly=»readonly» class="ResVol" type="text" id="vol" name="vol"
    value="$conv $conv2 "> 
  </div>
  EOD;   
  
    date_default_timezone_set("America/Mexico_City");
    $fecha1=date("Y/m/d");
    $fecha2=date("Y/m/d",strtotime("-1 day"));
    $fecha3=date("Y/m/d",strtotime("-2 day"));
    $fecha4=date("Y/m/d",strtotime("-3 day"));
    $fecha5=date("Y/m/d",strtotime("-4 day"));
         
  $mysqli2 = getConn();
  $num = $row[numeroparte];
  $co= "SELECT * FROM act where numero_parte='$num'";
  $r = $mysqli2->query($co);
    while($row2 = $r->fetch_array(MYSQLI_ASSOC)){
      $calendario =$row2[calendario];   
    }

if (strncmp($calendario,$fecha1, 10) === 0) {
    
    $mysqli3 = getConn();
    $numero = $row[numeroparte];
    $consulta= "SELECT count(numero_parte)+1 as cantidad from act 
    where numero_parte='$numero' AND calendario='$fecha1' OR 
          numero_parte='$numero' AND calendario='$fecha2' OR 
          numero_parte='$numero' AND calendario='$fecha3' OR 
          numero_parte='$numero' AND calendario='$fecha4' OR 
          numero_parte='$numero' AND calendario='$fecha5'";
    $resultado = $mysqli3->query($consulta);
    while($row3 = $resultado->fetch_array(MYSQLI_ASSOC)){
    $extraido =$row3[cantidad];
    }
} else if (strncmp($calendario,$fecha2, 10) === 0) {
    $mysqli4 = getConn();
    $numero = $row[numeroparte];
    $con4= "SELECT count(numero_parte)+1 as cantidad from act 
    where numero_parte='$numero' AND calendario='$fecha2' OR  
          numero_parte='$numero' AND calendario='$fecha1' OR
          numero_parte='$numero' AND calendario='$fecha3' OR 
          numero_parte='$numero' AND calendario='$fecha4' OR
          numero_parte='$numero' AND calendario='$fecha5'";
    $res4 = $mysqli4->query($con4);
    while($row4 = $res4->fetch_array(MYSQLI_ASSOC)){
    $extraido =$row4[cantidad];
    }

} else if (strncmp($calendario,$fecha3, 10) === 0) {
    $mysqli5 = getConn();
    $numero = $row[numeroparte];
    $con5= "SELECT count(numero_parte)+1 as cantidad from act 
    where numero_parte='$numero' AND calendario='$fecha3' OR  
          numero_parte='$numero' AND calendario='$fecha2' OR  
          numero_parte='$numero' AND calendario='$fecha1' OR
          numero_parte='$numero' AND calendario='$fecha4' OR
          numero_parte='$numero' AND calendario='$fecha5'";
    $res5 = $mysqli5->query($con5);
    while($row5 = $res5->fetch_array(MYSQLI_ASSOC)){
    $extraido =$row5[cantidad];
    }

}else if (strncmp($calendario,$fecha4, 10) === 0) {
    $mysqli6 = getConn();
    $numero = $row[numeroparte];
    $con6= "SELECT count(numero_parte)+1 as cantidad from act 
    where numero_parte='$numero' AND calendario='$fecha4' OR  
          numero_parte='$numero' AND calendario='$fecha3' OR  
          numero_parte='$numero' AND calendario='$fecha2' OR
          numero_parte='$numero' AND calendario='$fecha1' OR
          numero_parte='$numero' AND calendario='$fecha5'";
    $res6 = $mysqli6->query($con6);
    while($row6 = $res6->fetch_array(MYSQLI_ASSOC)){
    $extraido =$row6[cantidad];
    }
 }else if (strncmp($calendario,$fecha5, 10) === 0) {
    $mysqli7 = getConn();
    $numero = $row[numeroparte];
    $con7= "SELECT count(numero_parte)+1 as cantidad from act 
    where numero_parte='$numero' AND calendario='$fecha5' OR  
          numero_parte='$numero' AND calendario='$fecha4' OR  
          numero_parte='$numero' AND calendario='$fecha3' OR
          numero_parte='$numero' AND calendario='$fecha2' OR
          numero_parte='$numero' AND calendario='$fecha1'";
    $res7 = $mysqli7->query($con7);
    while($row7 = $res7->fetch_array(MYSQLI_ASSOC)){
    $extraido =$row7[cantidad];
    }
  }else {
        $extraido =1;
    }

  $mysqlirp = getConn();
  $numero = $row[numeroparte];
  $consulta= "SELECT * FROM act where numero_parte='$numero'";
  $resultado = $mysqlirp->query($consulta);
    while($row2 = $resultado->fetch_array(MYSQLI_ASSOC)){
      $turno1 =$row2[turno1];
      $turno2 =$row2[turno2];
      $turno3 =$row2[turno3];
      $turno4 =$row2[turno4];
      $turno5 =$row2[turno5];
      $turno6 =$row2[turno6];
      $noprod1 =$row2[noprod1];
      $noprod2 =$row2[noprod2];
      $noprod3 =$row2[noprod3];
    }

 $step = <<<EOD

  <div class="caja-step">
    <input class="step" value="$extraido" type="text" name="step" id="step" readonly=»readonly» >
  </div>

 
  EOD;

if ($extraido == 1) {
    
    $turno10= <<<EOD

      <div class="turno1a">
        <select class="Sturnoa" name="turno1" required="required">
          <option></option><option>00:00</option><option>00:30</option><option>01:00</option>    
          <option>01:30</option><option>02:00</option><option>02:30</option><option>03:00</option>      
          <option>03:30</option><option>04:00</option><option>04:30</option><option>05:00</option>      
          <option>05:30</option><option>06:00</option><option>06:30</option><option>07:00</option>     
          <option>07:30</option><option>08:00</option><option>08:30</option><option>09:00</option>
          <option>09:30</option><option>10:00</option><option>10:30</option><option>11:00</option> 
          <option>11:30</option><option>12:00</option><option>12:30</option><option>13:00</option>
          <option>13:30</option><option>14:00</option><option>14:30</option><option>15:00</option>
          <option>15:30</option><option>16:00</option><option>16:30</option><option>17:00</option>
          <option>17:30</option><option>18:00</option><option>18:30</option><option>19:00</option>
          <option>19:30</option><option>20:00</option><option>20:30</option><option>21:00</option>
          <option>21:30</option><option>22:00</option><option>22:30</option><option>23:00</option>
          <option>23:30</option>
        </select>
        </div>


    EOD;

    $turno20= <<<EOD

      <div class="turno2a">
        <select class="Sturnoa" name="turno2" required="required">
          <option></option><option>00:00</option><option>00:30</option><option>01:00</option><option>01:30</option><option>02:00</option><option>02:30</option><option>03:00</option>      
          <option>03:30</option><option>04:00</option><option>04:30</option><option>05:00</option>      
          <option>05:30</option><option>06:00</option><option>06:30</option><option>07:00</option>     
          <option>07:30</option><option>08:00</option><option>08:30</option><option>09:00</option>
          <option>09:30</option><option>10:00</option><option>10:30</option><option>11:00</option> 
          <option>11:30</option><option>12:00</option><option>12:30</option><option>13:00</option>
          <option>13:30</option><option>14:00</option><option>14:30</option><option>15:00</option>
          <option>15:30</option><option>16:00</option><option>16:30</option><option>17:00</option>
          <option>17:30</option><option>18:00</option><option>18:30</option><option>19:00</option>
          <option>19:30</option><option>20:00</option><option>20:30</option><option>21:00</option>
          <option>21:30</option><option>22:00</option><option>22:30</option><option>23:00</option>
          <option>23:30</option>
        </select>
        </div>


    EOD;

    $turno30= <<<EOD

      <div class="turno3a">
        <select class="Sturnoa" name="turno3" required="required">
          <option></option><option>00:00</option><option>00:30</option><option>01:00</option>    
          <option>01:30</option><option>02:00</option><option>02:30</option><option>03:00</option>      
          <option>03:30</option><option>04:00</option><option>04:30</option><option>05:00</option>      
          <option>05:30</option><option>06:00</option><option>06:30</option><option>07:00</option>     
          <option>07:30</option><option>08:00</option><option>08:30</option><option>09:00</option>
          <option>09:30</option><option>10:00</option><option>10:30</option><option>11:00</option> 
          <option>11:30</option><option>12:00</option><option>12:30</option><option>13:00</option>
          <option>13:30</option><option>14:00</option><option>14:30</option><option>15:00</option>
          <option>15:30</option><option>16:00</option><option>16:30</option><option>17:00</option>
          <option>17:30</option><option>18:00</option><option>18:30</option><option>19:00</option>
          <option>19:30</option><option>20:00</option><option>20:30</option><option>21:00</option>
          <option>21:30</option><option>22:00</option><option>22:30</option><option>23:00</option>
          <option>23:30</option>
        </select>
        </div>
      

    EOD;

    $turno40= <<<EOD

      <div class="turno4a">
        <select class="Sturnoa" name="turno4" required="required">
          <option></option><option>00:00</option><option>00:30</option><option>01:00</option>    
          <option>01:30</option><option>02:00</option><option>02:30</option><option>03:00</option>      
          <option>03:30</option><option>04:00</option><option>04:30</option><option>05:00</option>      
          <option>05:30</option><option>06:00</option><option>06:30</option><option>07:00</option>     
          <option>07:30</option><option>08:00</option><option>08:30</option><option>09:00</option>
          <option>09:30</option><option>10:00</option><option>10:30</option><option>11:00</option> 
          <option>11:30</option><option>12:00</option><option>12:30</option><option>13:00</option>
          <option>13:30</option><option>14:00</option><option>14:30</option><option>15:00</option>
          <option>15:30</option><option>16:00</option><option>16:30</option><option>17:00</option>
          <option>17:30</option><option>18:00</option><option>18:30</option><option>19:00</option>
          <option>19:30</option><option>20:00</option><option>20:30</option><option>21:00</option>
          <option>21:30</option><option>22:00</option><option>22:30</option><option>23:00</option>
          <option>23:30</option>
        </select>
        </div>

    EOD;

    $turno50= <<<EOD

      <div class="turno5a">
        <select class="Sturnoa" name="turno5" required="required">
          <option></option><option>00:00</option><option>00:30</option><option>01:00</option><option>01:30</option><option>02:00</option><option>02:30</option><option>03:00</option>      
          <option>03:30</option><option>04:00</option><option>04:30</option><option>05:00</option>      
          <option>05:30</option><option>06:00</option><option>06:30</option><option>07:00</option>     
          <option>07:30</option><option>08:00</option><option>08:30</option><option>09:00</option>
          <option>09:30</option><option>10:00</option><option>10:30</option><option>11:00</option> 
          <option>11:30</option><option>12:00</option><option>12:30</option><option>13:00</option>
          <option>13:30</option><option>14:00</option><option>14:30</option><option>15:00</option>
          <option>15:30</option><option>16:00</option><option>16:30</option><option>17:00</option>
          <option>17:30</option><option>18:00</option><option>18:30</option><option>19:00</option>
          <option>19:30</option><option>20:00</option><option>20:30</option><option>21:00</option>
          <option>21:30</option><option>22:00</option><option>22:30</option><option>23:00</option>
          <option>23:30</option>
        </select>
      </div>

    EOD;

    $turno60= <<<EOD

      <div class="turno6a">
        <select class="Sturnoa" name="turno6" required="required">
          <option></option><option>00:00</option><option>00:30</option><option>01:00</option><option>01:30</option><option>02:00</option><option>02:30</option><option>03:00</option>      
          <option>03:30</option><option>04:00</option><option>04:30</option><option>05:00</option>      
          <option>05:30</option><option>06:00</option><option>06:30</option><option>07:00</option>     
          <option>07:30</option><option>08:00</option><option>08:30</option><option>09:00</option>
          <option>09:30</option><option>10:00</option><option>10:30</option><option>11:00</option> 
          <option>11:30</option><option>12:00</option><option>12:30</option><option>13:00</option>
          <option>13:30</option><option>14:00</option><option>14:30</option><option>15:00</option>
          <option>15:30</option><option>16:00</option><option>16:30</option><option>17:00</option>
          <option>17:30</option><option>18:00</option><option>18:30</option><option>19:00</option>
          <option>19:30</option><option>20:00</option><option>20:30</option><option>21:00</option>
          <option>21:30</option><option>22:00</option><option>22:30</option><option>23:00</option>
          <option>23:30</option>
          </select>
      </div>

    EOD;

     $noprod10= <<<EOD
      <div class="input-noproda">
        <input type="text" required="" name="noprod1" id="noprod1" class="noprodb" >
      </div>
    EOD;

  $noprod20= <<<EOD
      <div class="input-noprodb">
        <input type="text" required="" name="noprod2" id="noprod2" class="noprodb" >
      </div>
    EOD;

   $noprod30= <<<EOD
      <div class="input-noprodc">
        <input type="text" required="" name="noprod3" id="noprod3" class="noprodb" >
      </div>
    EOD;


}else{

  $turno10= <<<EOD

  <div class="turno1b">
    <input class="Sturnob" value="$turno1" type="text" name="turno1" id="turno1" readonly=»readonly» >
  </div>

  EOD;

 $turno20= <<<EOD

  <div class="turno2b">
    <input class="Sturnob" value="$turno2" type="text" name="turno2" id="turno2" readonly=»readonly» >
  </div>

  EOD;

   $turno30= <<<EOD

  <div class="turno3b">
    <input class="Sturnob" value="$turno3" type="text" name="turno3" id="turno3" readonly=»readonly» >
  </div>

  EOD;

   $turno40= <<<EOD

  <div class="turno4b">
    <input class="Sturnob" value="$turno4" type="text" name="turno4" id="turno4" readonly=»readonly» >
  </div>

  EOD;

   $turno50= <<<EOD

  <div class="turno5b">
    <input class="Sturnob" value="$turno5" type="text" name="turno5" id="turno5" readonly=»readonly» >
  </div>

  EOD;

   $turno60= <<<EOD

  <div class="turno6b">
    <input class="Sturnob" value="$turno6" type="text" name="turno6" id="turno6" readonly=»readonly» >
  </div>

  EOD;

  $noprod10= <<<EOD
      <div class="input-noproda">
        <input type="text" required="" name="noprod1" id="noprod1" class="noprodb" value="$noprod1" readonly=»readonly» >
      </div>
    EOD;

  $noprod20= <<<EOD
      <div class="input-noprodb">
        <input type="text" required="" name="noprod2" id="noprod2" class="noprodb" value="$noprod2" readonly=»readonly» >
      </div>
    EOD;

   $noprod30= <<<EOD
      <div class="input-noprodc">
        <input type="text" required="" name="noprod3" id="noprod3" class="noprodb" value="$noprod3" readonly=»readonly» >
      </div>
    EOD;

}

  $videos .= "<option value=' $prov $parte $descripcion $precio2 $yearly2 $volumen $step $turno10 $turno20 $turno30 $turno40 
    $turno50 $turno60 $noprod10 $noprod20 $noprod30 '>$row[numeroparte]</option>";
  
}
  return $videos;
}

echo getpartes();
?>
6
  • no jajajaja , en el caso de él es por que no cerraba los EOD pero yo sí los tengo cerrados. Commented el 26 may. 2021 a las 15:51
  • 2
    Quítale TODOS los espacios y la indentación en las líneas de los EOD; para hacerle caso a la documentación. Lo otro es que quitarle las comillas simples a los identificadores de elementos en $row suena a una pésima idea pero pues... ya te dará el warning de que no encuentra los elementos...
    – Alfabravo
    Commented el 26 may. 2021 a las 16:24
  • PD. Qué chafa VisualStudio (su plugin) que no se dé cuenta de ésto. El de Notepad++ lo marca perfecto
    – Alfabravo
    Commented el 26 may. 2021 a las 16:25
  • 1
    @GerardoMartínez, no, en el caso de la otra pregunta el problema era que tenia un comentario en la misma linea donde cerraba. En tu caso, el error son los espacios. La respuesta en la otra pregunta señala claramente esto.
    – Marcos
    Commented el 26 may. 2021 a las 17:05
  • nada, aun así me lo sigue marcando Commented el 26 may. 2021 a las 17:12

1 respuesta 1

0

por si a alguien le sirve así quedaron lo EOD sin nada que espacios hasta que el hosting me los marco como correctos, cheque que no hubieran espacios antes ni después de cerrarlos y que tampoco tuvieran comentarios.

$precio2 = <<<EOD
  <div class="caja_descripcion20" type="number"> 
    <input readonly=»readonly» class="ResNum" type="text" id="price" name="price" 
    value="$&nbsp; $precio "> 
  </div>
EOD;
1
  • 1
    Solo el cierre debe estar pegado al inicio de la línea, al de apertura esto no lo afecta.
    – Marcos
    Commented el 26 may. 2021 a las 18:35

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.