0
I have a table with five columns and two records. One of the fields in the record is a number (notaQualif), I need the field in which it is inserted to be painted green if it is greater than 75 and painted red if it is less than 75.
All data is stored in a database created in phpmyadmin, so it is necessary that when the user enters data, the notaQualif is checked and is soon painted green or red.
I leave here the code made so far that contemplates the table with the data.
<head><title>Ver registos</title></head>
<?php
LigarBDfater(); //connect to the database
// get results from database
$result = mysql_query("SELECT * FROM qualificacao") or die(mysql_error());
// display data in table
echo "<p><b>View All</b> | <a href='view-paginated.php?page=1'>View Paginated</a></p>";
echo "<table border='1' cellpadding='10'>";
echo "<tr><th>ID Qualificação</th> <th>ID Fornecedor</th> <th>Nome Funcionario</th> <th>Nota Qualificação</th> <th>Data Qualificação</th></tr>";
// loop through results of database query, displaying them in the table
while($row = mysql_fetch_array($result)){
// echo out the contents of each row into a table
echo "<tr>";
echo '<td>' . $row['id_qualific'] . '</td>';
echo '<td>' . $row['id_fornecedor'] . '</td>';
echo '<td>' . $row['nomeFuncionario'] . '</td>';
echo '<td>' . $row['notaQualif'] . '</td>';
echo '<td>' . $row['dataQualif'] . '</td>';
echo "</tr>";
}
// close table>
echo "</table>";
?>
<p align="left"><a href="novo_qualificacao.php">Adicionar um novo registo</a></p>
Put the code here, at least part, so I can help you.
– Thiago Santos
There is a link in the "I leave it here" that redirects to the Dropbox with the code. Could visualize ?
– pedrocxb
As your question will be recorded here, it is good practice (if not a rule), paste the code into the body of the question.
– NewtonWagner
Okok, I edited and now it’s in code
– pedrocxb
@crispypedro_ with code became very simple, check if the answer fits you.
– Thiago Santos