0
The query variable that I use to query the position in the database is the $fornecedor
who receives $_POST['fornecedor']
from another page, but the query does not return values only goes blank, when I use the function mysqli_errno()
she returns 0. The connection to the database is configured in the function infoConnect()
which is being imported into include, the connection is being made normally. When I do the query without WHERE in the query only using SELECT and FROM with return but this WHERE filter is necessary for the correct functioning of the system, anyway, I am not able to visualize the error.
<?php
include "../requeriments/connect_info.php";
$fornecedor = $_POST['fornecedor'];
echo("<br>");
echo($fornecedor); /*Teste para ver se variável está definida*/
$query = " SELECT id, nome, tipo, capacidade, custo, telefone, urlthumb FROM fornecedores WHERE nome = '$fornecedor' ";
$result = mysqli_query(infoConnect(), $query) or die("Erro na consulta.");
while($row_result = mysqli_fetch_assoc($result)) {
?>
<form method="POST" action="alter_provider.php" enctype="multipart/form-data">
<label for="id" id="formColum_1">Id:</label>
<input type="number" placeholder="<?php echo(($row_result['id'])); ?>" id="formColumn_2" name="id" disabled><br>
<label for="nome" id="formColum_1">Fornecedor:</label>
<input type="text" placeholder="<?php echo(utf8_encode($row_result['nome'])); ?>" id="formColumn_2" name="nome" ><br>
<label for="tipo" id="formColum_1">Tipo:</label>
<input type="text" placeholder="<?php echo(utf8_encode($row_result['tipo'])); ?>" id="formColumn_2" name="tipo" ><br>
<label for="capacidade" id="formColum_1">Capacidade:</label>
<input type="number" placeholder="<?php echo($row_result['capacidade']); ?>" id="formColumn_2" name="capacidade" ><br>
<label for="custo" id="formColum_1">Custo:</label>
<input type="number" placeholder="<?php echo($row_result['custo']); ?>" id="formColumn_2" name="custo" ><br>
<label for="telefone" id="formColum_1">Telefone:</label>
<input type="tel" placeholder="<?php echo($row_result['telefone']); ?>" id="formColumn_2" name="telefone" ><br>
<label for="urlthumb" id="formColum_1">Imagem:</label>
<input type="file" id="formColumn_2" name="urlthumb" accept="image/jpeg, image/png"><br><br>
<button type="submit" class="btn btn-primary">Alterar</button>
</form>
<?php } ?>