我想为我拥有的论坛输入上一个和下一个按钮,因为在论坛变长后,它超过了背景图像并且看起来不太好!有谁知道一种简单的方法或者我可以查看上一个和下一个按钮的东西?我想要它,所以每页仅限于每页 5 个帖子或其他内容。
这是代码,如果它有帮助的话。如果这是一个愚蠢的问题,我很抱歉。
<?php
$dbc=mysql_connect('host','user','password','database') or die(mysql_error());
mysql_select_db('database',$dbc) or die(mysql_error());
?>
View Posts <br>
<form method="get" action="view_forum.php">
<label>Select Weather to Filter </label><br />
<select name="weather">
<option value="all">all</option>
<option value="cloudy">Cloudy</option>
<option value="sunny">Sunny</option>
<option value="windy">Windy</option>
<option value="snowy">Snowy</option>
<option value="mixy">Wintery Mix</option>
<option value="rainy">Rainy</option>
</select>
<input type="submit" value="view" />
</form>
<div id="view">
<center><img src="images/forum.png" width="589" height="97"></center>
</div>
<div id="white">
<div id="blue">
<div id="grey">
<div id="container">
<?php
$weather = mysql_real_escape_string( $_GET["weather"] ); // keep your input clean
if ( $weather == "all" ) {
$sql = "SELECT * FROM stories ORDER BY id DESC";
} else {
$sql = "SELECT * FROM stories WHERE weather = '$weather' ORDER BY id DESC";
}
$result = mysql_query( $sql ) or die( mysql_error() );
while ( $row = mysql_fetch_assoc( $result ) ) {
echo "<div class=\"names\"> {$row['name']}<br /></div>";
echo "<div class=\"weathers\">{$row['weather']}<br /></div>";
echo "<div class=\"stories\">{$row['story']}<br /></div>";
echo "<img src=\"images/line.png\" width='800' height='3'>";
echo "<br />";
}
?>
</div>
</div>
</div>
</div>