1
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 subsidiary holding the product
- Availability (which if it exists in the stock table will be green, otherwise red)
Below is the table and column data I need to use
db_product
CODE, CLASS, DESCRIPTION
db_stock
COD_FILIAL, CODIGO_PRODUTO
db_filial
COD_FILIAL, NOME_FILIAL
That is mine code COMPLETE
<?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>";
?>
That code has nothing to do with what I posted. It is difficult this way copy and paste my code is the error that is happening along with the creation of the file Conn.php
– Victor
I edited my answer by comparing the code of the db_product table with the code of the db_stock table
– Victor
Now it worked, could you tell me how it works? Some characters have this symbol , so I can signal with any character in the availability field, where I need to make the change?
– Alexandra
Alexandra, you have an answer here regarding the strange characters... I believe the rest of your current question has been resolved with @Victor’s answer, correct? These characters are worthy of another question, not this one
– Jefferson Quesado
Yeah, I’ll look it up. obgd
– Alexandra
I found the question I had in mind: https://answall.com/q/43193/64969; I don’t know any other of this context here Sopt. If it doesn’t help... the new question button is right there #Hue
– Jefferson Quesado
@Jeffersonquesado Thanks, I managed to solve
– Alexandra
@Alexandra, did you manage to figure out which way your result was ?
– Victor
@Alexandra, I tried to make the title more appropriate to the community proposal
– Jefferson Quesado
@Victor Yes, it worked, I tested and the data is also correct with the BD!
– Alexandra
I’m glad I could help, any doubt we’re there
– Victor