ERROR Parse error: syntax error, unexpected ''

0

this error is appearing in my code: Parse error: syntax error, unexpected '<' in /home/storage/3/da/ca/public_html/ViewRevisao.php on line 110

What would be the solution in this case

<?phpinclude_once("conexao.php");
            $result_cursos = "SELECT DISTINCT b.prefixo as idVeiculo, max(datatroca) as datatroca, max(kmtroca) as kmtroca, max(horimetroca) as horimetroca, max(proximatroca) as proximatroca, max(c.horimetro) as horimetroatual, (a.proximatroca - max(c.horimetro)) as horasrestantes, idMecanico FROM revisao a
              JOIN veiculos b on (a.idVeiculo=b.idVeiculo)
              JOIN hodometro c on (a.idVeiculo=c.idVeiculo)
              GROUP BY a.idVeiculo order by datatroca DESC; ";
            $resultado_cursos = mysqli_query($conn, $result_cursos);
            ?>
            <?php while ($rows_cursos = mysqli_fetch_assoc($resultado_cursos)) { ?>
                <tr>
                    <td><?php echo $rows_cursos['idVeiculo']; ?></td>
                    <td><?php echo date('d/m/Y', strtotime($rows_cursos['datatroca'])); ?></td>
                    <td><?php echo $rows_cursos['kmtroca']; ?></td>
                    <td><?php echo $rows_cursos['horimetroca']; ?></td>
                   <b> <td><?php echo $rows_cursos['proximatroca']; ?></td><b>
                     <td><?php echo $rows_cursos['horimetroatual']; ?></td>
                       <td><b><?php echo $rows_cursos['horasrestantes']; ?><b></td>
                    <td><?php
                        if ($rows_cursos['horasrestantes'] >= 150) {

         $status1 = "A VENCER";

          $query  = ("UPDATE revisao SET status = '$status1' WHERE idVeiculo = '".<?php echo $row_usuario['idVeiculo']; ?>."'") or die (mysql_error());
          $result = mysqli_query($conn,$query);


          ?>

        <button class="btn btn-success btn-sm" type="button">A vencer</button>

        <?php

        } elseif ($rows_cursos['horasrestantes'] > 1) {

        $status2 = "VENCEDO";


        $query  = ("UPDATE revisao SET status = '$status2' WHERE idRevisao ="<?php echo $rows_cursos['idVeiculo']; ?>""); or die (mysql_error());
          $result = mysqli_query($conn,$query);


        ?>

        <button class="btn btn-warning btn-sm" type="button">Vencendo</button>

        <?php

        } elseif ($rows_cursos['horasrestantes'] <= 0) {

        $status3 = "VENCIDA";

          $query  = ("UPDATE revisao SET status = '$status3' WHERE idRevisao ="<?php echo $rows_cursos['idVeiculo']; ?>""); or die (mysql_error());
          $result = mysqli_query($conn,$query);


        ?>
        <button class="btn btn-danger btn-sm" type="button">Vencida</button>

        <?php
        }
        ?>
              </tr>
         <?php } ?>
    
asked by anonymous 26.05.2018 / 17:24

1 answer

3
  

You're putting PHP into PHP. That's wrong $query = ("UPDATE revisao SET status = '$status1' WHERE idVeiculo = '".<?php echo $row_usuario['idVeiculo']; ?>."'") or die (mysql_error()); That's right $query = ("UPDATE revisao SET status = '$status1' WHERE idVeiculo = '".$row_usuario['idVeiculo']."'") or die (mysql_error());

I have improved the indentation and put only PHP.

<?php

include_once("conexao.php");

$result_cursos = "SELECT DISTINCT b.prefixo as idVeiculo, max(datatroca) as datatroca, max(kmtroca) as kmtroca, max(horimetroca) as horimetroca, max(proximatroca) as proximatroca, max(c.horimetro) as horimetroatual, (a.proximatroca - max(c.horimetro)) as horasrestantes, idMecanico FROM revisao a
              JOIN veiculos b on (a.idVeiculo=b.idVeiculo)
              JOIN hodometro c on (a.idVeiculo=c.idVeiculo)
              GROUP BY a.idVeiculo order by datatroca DESC; ";

$resultado_cursos = mysqli_query($conn, $result_cursos);

while ($rows_cursos = mysqli_fetch_assoc($resultado_cursos)) {
            echo "<tr>
            <td>".$rows_cursos['idVeiculo']."</td>
            <td>".date('d/m/Y', strtotime($rows_cursos['datatroca']))."</td>
            <td>".$rows_cursos['kmtroca']."</td>
            <td>".$rows_cursos['horimetroca']."</td>
            <b> <td>".$rows_cursos['proximatroca']."</td><b>
            <td>".$rows_cursos['horimetroatual']."</td>
            <td><b>".$rows_cursos['horasrestantes']."<b></td>
            <td>";            

    if ($rows_cursos['horasrestantes'] >= 150) {

        $status1 = "A VENCER";

        $query  = ("UPDATE revisao SET status = '$status1' WHERE idVeiculo = '".$row_usuario['idVeiculo']."'") or die (mysql_error());
        $result = mysqli_query($conn,$query);

        echo '<button class="btn btn-success btn-sm" type="button">A vencer</button>';

    } elseif ($rows_cursos['horasrestantes'] > 1) {

       $status2 = "VENCEDO";

       $query  = ("UPDATE revisao SET status = '$status2' WHERE idRevisao ='".$rows_cursos['idVeiculo']."'") or die (mysql_error());
       $result = mysqli_query($conn,$query);

       echo '<button class="btn btn-warning btn-sm" type="button">Vencendo</button>';

    } elseif ($rows_cursos['horasrestantes'] <= 0) {

        $status3 = "VENCIDA";

        $query  = ("UPDATE revisao SET status = '$status3' WHERE idRevisao ='".$rows_cursos['idVeiculo']."'") or die (mysql_error());
        $result = mysqli_query($conn,$query);

        echo '<button class="btn btn-danger btn-sm" type="button">Vencida</button>';

     }

      echo '</tr>';
} 

?>
  

Any doubt or error in the code (I may have missed something) , leave it in the comment below.

    
26.05.2018 / 18:12