I recently started my studies in the area and I have a difficulty in the code.
I need to display the data as follows:
- Product code
- Product class
- Product Description
- Name of the branch where you have the product
- Availability (if it exists in the stock table it will turn green, otherwise red)
Below is the table and column data that I need to use
db_product
CODE, CLASS, DESCRIPTION
db_estoque
COD_FILIAL, CODE_PRODUCT
db_filial
COD_FILIAL, FULL_NAME
This is my code FULL
<?php
//tabela
echo "<table border=1>";
echo "<tr>";
echo "<th>Codigo</th>";
echo "<th>Descrição</th>";
echo "<th>Classe</th>";
echo "<th>Disponibilidade</th>";
echo "</tr>";
//conexão
$strcon = mysqli_connect('localhost','s.o','b.7','s.a') or die ('Erro');
$sql = "SELECT * FROM db_produto";
$resultado = mysqli_query($strcon,$sql) or die('erro bd');
//resultados loop
while ($registro = mysqli_fetch_array($resultado))
{
$codigo = $registro['CODIGO'];
$descricao = $registro['DESCRICAO'];
$classe = $registro['CLASSE'];
echo "<tr>";
echo "<td>".$codigo;"</td>";
echo "<td>".$descricao;"</td>";
echo "<td>".$classe;"</td>";
echo "</tr>";
}
// fim while
mysqli_close($strcon);
echo "</table>";
?>