ERROR Parse error: syntax error, Unexpected '<'

Asked

Viewed 222 times

0

this error appears 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

inserir a descrição da imagem aqui

<?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);
            ?>
            <?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 } ?>

1 answer

3


You’re putting PHP inside PHP. This is 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 improved the identation 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 in the comment below.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.