我正在制作一个博客,并且正在尝试制作它,以便它显示我的帖子从最早到最旧。我认为最简单的方法是使用 array_reverse() 函数。
我以前从未使用过它,所以我需要一些建议。
这是我当前的代码,我该如何输入?
<?php
$connect = mysql_connect("****","****","******");
mysql_select_db("****");
$posts = mysql_query("SELECT * FROM Posts");
WHILE($data = mysql_fetch_array($posts)):
$picture = $data['Picture'];
$pname = $data['Name'];
$date = $data['Date'];
$poster = $data['Poster'];
$ptext = $data['Text'];
?>
<div class="row">
<li class="span12">
<div class="thumbnail">
<div class="img-wrap">
<center>
<a href="#">
<img src="<?php echo "$picture"; ?>" alt=""/>
</a>
</center>
</div>
<h3><?php echo "$pname"; ?></h3>
<div class="info-panel clearfix">
<span class="pull-left">
<time datetime="">
<i class="icon-calendar "></i> <?php echo "$date"; ?>
</time>
</span>
<span class="pull-right">
<i class="icon-user"></i> By <?php echo "$poster"; ?>
</span>
</div>
<p><?php echo "$ptext"; ?></p>
</div>
</li>
</div>
<?php
endwhile;
?>