0
I am trying to visualize elements of a row of a table of mine, only separately. And I have not been succeeding.
Follows the code:
<?php
require_once("conexao.php");
$id = $_POST['idlicita'];
$query = "select * from licitacao where idlicita = $id";
$resultado = mysqli_query($conexao,$query);
$visu = mysqli_fetch_assoc($resultado);
echo $visu["objeto"];
Excerpt from the form where the ID
corresponding to the item I want to view:
<form action="visualiza.php" method="post">
<input type="hidden" name="idlicita" value="<?$licitacao['idlicita']?>">
<button type="submit" class="btn btn-success">Visualizar</button>
</form>
EDIT:
Mistake you’re making:
Warning: mysqli_fetch_assoc() expects Parameter 1 to be mysqli_result, Boolean Given in C: xampp htdocs painelnovo pages visualiza.php on line 10
To read a line you just don’t need the
while
, and only the instruction that is there :$visu = mysqli_fetch_assoc($resultado)
. In the database for this tablelicitacao
has a fieldobjeto
? And when you say "And I haven’t been succeeding" what happens? It makes a mistake ? If yes add the error to the question– Isac
I edited, took the while and put only one line
– Pedro Ribeiro
The
$_POST
doesn’t have the fieldidlicita
. Confirm what you receive from the form withvar_dump($_POST);
– Isac
I don’t understand what you mean
– Pedro Ribeiro
<?$licitacao['idlicita']?>
missing a=
and should be<?=$licitacao['idlicita']?>
– Isac
That really was it. Thank you very much
– Pedro Ribeiro