Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá amigos, eu criei um sistema de postagens em php, e na pagina onde são mostradas as postagens , eu quero que as com maior numero na ID apareçam em cima, ecada vez que eu postar a mais nova vai ficando em cima, mas não sei como fazer esta inversão.
Por favor alguém me ajuda. Obrigado
Esse é o código que eu to usando pra mostrar os Posts.
<?php require_once('Connections/config.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_config, $config);
$query_Recordset1 = "SELECT * FROM conteudo";
$Recordset1 = mysql_query($query_Recordset1, $config) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<link rel="stylesheet" type="text/css" href="style.css">
<?php
include"config.php";
$sql = mysql_query("SELECT * FROM atualizacao");
while ($linha = mysql_fetch_array($sql)){
$id = $linha['id'];
$titulo = $linha['titulo'];
$img = $linha['img'];
$dow = $linha['dow'];
$video = $linha['video'];
$descricao = $linha['descricao'];
"<a href=atualizacao.php?id=$id>$titulo</a>";
}
?>
<link rel="stylesheet" type="text/css" href="css/conteudo_rec.css">
<?php do { ?>
<div id="con_receptor">
<div id="rece_imagem"><img src="<?php echo $row_Recordset1['img_con']; ?>" /></div>
<div id="infor_rec"><?php echo $row_Recordset1['nome_rec']; ?>
<div class="lançamento" style="color:#F00;"><?php echo $row_Recordset1['data_atu']; ?></div></div>
<div id="bt_ver_mais"><a href="atualizacao.php?id=<?php echo $row_Recordset1['link_con']; ?>">Ver mais</a></div>
</div>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
<?php
mysql_free_result($Recordset1);
?>Carregando comentários...