I'm creating a loop and I'm having trouble with syntax error, looking the article PHP Parse/Syntax erros and how to solve them I follow the instructions but my problem was not solved. Parse error: syntax error, unexpected 'else' (T_ELSE) in C:\xampp\htdocs\customers\index.php on line 160 still appear and I try to run this code:
<tbody>
<?php if ($customers):?>
<?php foreach($customers as $customer){?>
<tr>
<td><?php echo $customer['id']; ?></td>
<td><?php echo $customer['nome']; ?></td>
<td><?php echo $customer['usuario']; ?></td>
<td><?php echo $customer['uno']; ?></td>
<td><?php echo $customer['editado']; ?></td>
<td class="actions text-right">
<a href="view.php?id=<?php echo $customer['id']; ?>"
class="btn btn-sm btn-success"><i class="fa fa-eye"></i> Visualizar</a>
<?php if($_SESSION['UsuarioNivel'] == 3){
echo "<a href=\"edit.php?id=<?php echo $customer[id];
?>\"class=\"btn btn-sm btn-warning\"><i class=\"fa fa-pencil\"></i> Editar
</a>";
?>
</td>
</tr>
<?php } ?>
<?php else { ?>
<tr>
<td colspan="6">Nenhum registro encontrado.</td>
</tr>
<?php endif; ?>
</tbody>
Aucun commentaire:
Enregistrer un commentaire