I have two identical codes. One works (user) and another does not (cars). Can someone explain to me why?
<html><head><metacharset="utf-8">
<title>Eliminar</title>
</head>
<body>
<?php
include("validar.php");
include("ligaBD.php");
$procura = "SELECT * FROM carros WHERE matricula LIKE '%".$_GET["mat"]."%'";
$faz_procura = mysqli_query($ligaBD, $procura);
$num_registos = mysqli_num_rows($faz_procura);
if($num_registos==0)
{
echo "Não foram encontrados registos. ";
echo "<a href='edita_elimina_carro.html'>Faça nova pesquisa";
exit;
}else
{
echo "<table border=0 width=300px><tr bgcolor=red>";
echo "<th>Nome</th><th>Idade</th><th>Email</th><th>Username</th>";
echo "<th>Password</th><th>Apagar</th></tr>";
for($i=0; $i<$num_registos; $i++)
{
$registos = mysqli_fetch_array($faz_procura);
if($i & 1)
{
echo '<tr bgcolor=yellow>';
}else
{
echo '<tr bgcolor=grey>';
}
echo '<td>'.$registos['matricula'];
echo '<td>'.$registos['user'];
echo '<td>'.$registos['marca'];
echo '<td>'.$registos['ano'];
echo '<td>'.$registos['celindrada'];
echo '<td><a href="apaga_carro.php?nome='.$registos['matricula'].'">Elimina</a>';
echo '</td>';
}
}
?>
</body>
</html>
Other:
<html>
<head>
<meta charset="utf-8">
<title>Eliminar</title>
</head>
<body>
<?php
include("validar_admin.php");
?>
<h3>Eliminar Utilizadores</h3>
<form method="GET" name="form1" action="edita_elimina_carronew.php">
<input type="text" name="mat">
<input type="submit" value="Pesquisar">
</form>
</body>
</html>
ERRORS:
Notice: Undefined index: Enroll in C: \ Program Files \ EasyPHP-DevServer-14.1VC11 \ data \ localweb \ Module 7 - Work n5 \ edita_elimina_carronew.php online 37
This error occurs several times for all items in the code.