0
I made an administrative page where I register in a form the information of books and their position (1st, 2nd place...), but I can not rescue from the database the information I need. My need is that, from your position, I put the data in html:
<article id="top">
<?php
include "acessoResponsivo.php";
$comando="select * from tb_top";
$matriz=mysql_query($comando);
$linha=mysql_fetch_array($matriz);
$posicao=$linha["posicao"];
if ($posicao=="1") {
?>
<h2>Top mais lidos</h2>
<div id="topum" class="numeracao">
<?php echo '<img src="img/' .$linha["imagemtop"]. '.jpg"> <br/> '; ?>
<h4 class="num">1</h4> <br> <?php echo '<p class="toptitulo">'.$linha["toptitulo"].'</p> '; ?></div>
<?php
}
//__________________________________dois_____________
else if ($posicao=="2") {
?>
<div id="topdois" class="numeracao">
<?php echo '<img src="img/' .$linha["imagemtop"]. '.jpg"> <br/> '; ?>
<h4 class="num">2</h4> <br> <?php echo '<p class="toptitulo">'.$linha["toptitulo"].'</p> '; ?></div>
<?php
}
//__________________________________tres_____________
else if ($posicao=="3") {
?>
<div id="toptres" class="numeracao">
<?php echo '<img src="img/' .$linha["imagemtop"]. '.jpg"> <br/> '; ?>
<h4 class="num">3</h4> <br> <?php echo '<p class="toptitulo">'.$linha["toptitulo"].'</p> '; ?></div>
<?php
}
//__________________________________quatro_____________
else if ($posicao=="4") {
?>
<div id="topquatro" class="numeracao">
<?php echo '<img src="img/' .$linha["imagemtop"]. '.jpg"> <br/> '; ?>
<h4 class="num">4</h4> <br> <?php echo '<p class="toptitulo">'.$linha["toptitulo"].'</p> '; ?></div>
<?php
}
//__________________________________cinco_____________
else if ($posicao=="5") {
?>
<div id="topcinco" class="numeracao">
<?php echo '<img src="img/' .$linha["imagemtop"]. '.jpg"> <br/> '; ?>
<h4 class="num">5</h4> <br> <?php echo '<p class="toptitulo">'.$linha["toptitulo"].'</p> '; ?></div>
<?php
}
?>
</article>
What is the structure of your table tb_top? Edit your question with the structure.
– Diéfani Favareto Piovezan
Welcome Caroline, be sure to read this post https://pt.meta.stackoverflow.com/questions/1078/como-e-por-que-aceitar-uma-resposta/1079#1079
– user60252