1
I’m trying to create one table with data from a database mysql, but when I open the page, it shows some results and then above appears this error:
Notice: Undefined index: TASK DESCRIPTION in C: xampp htdocs reghoras index.php on line 25
Notice: Undefined index: DURATION TASK in C: xampp htdocs reghoras index.php on line 28
Notice: Undefined index: PENDENTES in C: xampp htdocs reghoras index.php on line 29
Image of the database structure:
Time Log
<body>
<center><h2>Registo de Horas 2016</h2></center>
<br>
<?php
mb_internal_encoding("UTF-8");
include('connect_mysql.php');
$sqlget = "SELECT * FROM `bdreghoras` where id !=0";
$sqldata = mysqli_query($dbcon, $sqlget) or die('erro a obter os dados');
echo "<table border= '1' cellpadding= '10'>";
echo "<tr><th>Processo</th><th>Data (dd/mm/aaaa)</th><th>Utilizador</th><th>Descrição da Tarefa</th><th>Hora de inicio</th><th>Hora de Fim</th><th>Duração de Tarefa</th><th>Pendentes</th><th>Local</th></tr>";
while($row = mysqli_fetch_array($sqldata, MYSQLI_ASSOC)) {
echo "<tr>";
echo "<td>" . $row['PROCESSO'] . "</td>";
echo "<td>" . $row['DATA'] . "</td>";
echo "<td>" . $row['UTILIZADOR'] . "</td>";
echo "<td>" . $row['DESCRIÇÃO TAREFA'] . "</td>";
echo "<td>" . $row['HORA INICIO'] . "</td>";
echo "<td>" . $row['HORA FIM'] . "</td>";
echo "<td>" . $row['DURAÇÃO TAREFA'] . "</td>";
echo "<td>" . $row['PENDENTES'] . "</td>";
echo "<td>" . $row['LOCAL'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
</body>
I don’t know how to fix it I need help
can post your PHP code, and the table structure? This helps a lot to identify the problem. Welcome to SOPT :)
– David
Are you sure that in all rows these three columns have value?
– Edson Horacio Junior
the problem is in the columns Memory because they have space, try to use a
var_dump
to see how the names are being displayed.– RFL
it is highly recommended not to use accented characters and spaces in the seat structure, as these can be converted differently.
– Guilherme Lautert