1
I’m wanting my while instead of creating the block "element-item" down, create the block up, ie He orders from the youngest to the oldest and not from the oldest to the youngest
EXAMPLE: What is he doing:
BLOCO ID1 - BLOCO ID2 - BLOCO ID3
what I want:
BLOCO ID3 - BLOCO ID2 - BLOCO ID1
My code:
<?php
$servidor = 'localhost';
$banco = 'apixel_galeria';
$usuario = 'root';
$senha = '';
$link = @mysql_connect($servidor, $usuario, $senha);
$db = mysql_select_db($banco,$link);
if(!$link)
{
echo "erro ao conectar ao banco de dados!";exit();
}
$sql = "SELECT * FROM portfolio";
$query = mysql_query($sql);
while($sql = mysql_fetch_array($query)){
$id = $sql["id"];
$nome = $sql["nome"];
$tipo = $sql["tipo"];
$desc = $sql["desc"];
$menu = $sql["menu"];
$imageM = $sql["imageM"];
$imageF = $sql["imageF"];
?>
<div class="element-item <?php echo "$menu";?>" data-category="transition">
<a href="#portfolioModal54" class="portfolio-link" data-toggle="modal">
<img src="<?php echo "$imageM"?>" alt="project 2">
<div class="mask"> <div class="conteudo_mask" style="
transform: translateY(-50%);
top: 50%;
position: relative;
/* float: left; */
"> <h1><?php echo "$nome"?></h1> <div id="lin" style="
width: 200px;
"></div> <h2><?php echo "$tipo"?></h2> </div><h3 style="
transform: translateY(-50%);
top: 50%;
position: relative;
">VEJA <br><img src="images/mais.png" alt="mais" style="width: 20px;height: 19px;margin-bottom: -1px;margin-top: 3px;"></h3></div>
</a>
</div>
<?php
}
?>
ORDER BY id DESC
tried that?– rray
where do I put this friend?
– kaiquemix
SELECT * FROM portfolio ORDER BY id DESC
– rray
vlw friend worked out, had forgotten it :)
– kaiquemix
Good, you can mark Renato Tavares' reply as you accept :)
– rray
:) ready thank you.
– kaiquemix