-1
I have two identical codes. One works (user) and one doesn’t (cars). Someone can explain why?
<html>
<head>
<meta charset="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>
MISTAKES:
Notice: Undefined index: matricula in C: Program Files Easyphp-Devserver-14.1VC11 data localweb Module 7 - Work N5 edita_elimina_carronew.php on line 37
This error occurs several for all items in the code.
probably the table cars does not have the attribute license plate of a conferred
– SneepS NinjA
It gives the same error for all attributes.. :/
– lemario
put the structure of the two tables, put only the code of the file edita_elimina_carronew.php the files that have no error do not need
– SneepS NinjA
I’ve already edited the question.
– lemario