Soweit tut auch alles wunderbar.
Nur würd ich gerne dass die neuesten Einträge als erstes angezeigt werden.
Hab bei der SQL Abfrage das Order by von asc schon in DESC geändert aber bei der Ausgabe tut sich nichts.
Wäre nett wenn mal eben jemand drüber gucken kann danke.
- Code: Select all
<?php
include("Menue.php");
include("functions.inc.php");
if ( isset( $_REQUEST["seite"] ) && $_REQUEST["seite"] != "" )
{
$seite = $_REQUEST["seite"];
}
else
{
$seite = 1;
}
mysqlconnect();
// Bestimmen der Einträge-Anzahl
$gesamt = howmany();
$seitengesamt = ceil( $gesamt / 5 );
$offset = ( $seite - 1 ) * 5;
$query = "SELECT * FROM eintraege ORDER BY id ASC LIMIT " . $offset . ", 5";
$result = mysql_query( $query );
if ( ! $result )
{
die("Konnte die Datensätze nicht auslesen");
}
$anzahl = mysql_num_rows( $result );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Adobe GoLive 6">
<title>Willkommen bei Adobe GoLive 6</title>
<style type="text/css" media="screen"><!--
body { font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular }
a { color: red; text-decoration: none }
a:hover { text-decoration: underline }
.fliesstext { font-size: small }
.titel { font-weight: bold }
.beschr_hell { color: #ccc; font-weight: bold }
.maintitle { color: gray; font-weight: bold; font-size: large }
--></style>
</head>
<body bgcolor="#ffffff">
<table width="545" border="0" cellspacing="0" cellpadding="2">
<tr>
<td colspan="3" align="center" width="541">
<p class="maintitle">HumpenPumpen Gästebuch</p>
</td>
</tr>
<tr>
<td width="45"> </td>
<td width="388"> </td>
<td width="100"> </td>
</tr>
<tr>
<td width="45"></">Home</a></td>
<td align="center" width="388"><a href="new.php">Neuer Eintrag</a></td>
<td width="100"><a href="admin.php"></a></td>
</tr>
</table>
<p></p>
<table width="550" border="0" cellspacing="0" cellpadding="2">
<?php
// Schleife zum Ausgeben der einzelnen Datensätze in Tabellen-Reihen
for ( $i=1; $i <= $anzahl; $i++)
{
$datensatz = mysql_fetch_array( $result );
?>
<tr>
<td class="beschr_hell" align="left" valign="top" bgcolor="#666666" width="80">Datum</td>
<td class="beschr_hell" align="left" valign="top" bgcolor="#666666" width="363"> </td>
<td class="beschr_hell" align="left" valign="top" bgcolor="#666666" width="95">Autor</td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#cccccc" width="80"><?php echo $datensatz["Datum"]; ?></td>
<td align="left" valign="top" bgcolor="#cccccc" width="363"> </td>
<td align="left" valign="top" bgcolor="#cccccc" width="95">
<a href="<?php
if ( $datensatz["Email"] != "" )
{
echo "mailto: " . $datensatz["Email"];
}
else
{
echo "#";
}; ?>">
<?php echo $datensatz["Autor"]; ?></a></td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#999999" width="80"> </td>
<td align="left" valign="top" bgcolor="#999999" width="363"> </td>
<td align="left" valign="top" bgcolor="#999999" width="95"> </td>
</tr>
<tr>
<td class="beschr_hell" align="left" valign="top" bgcolor="#999999" width="80">Titel</td>
<td colspan="2" align="left" valign="top" bgcolor="#cccccc" width="462">
<p class="titel"><?php echo $datensatz["Titel"]; ?></p>
</td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#999999" width="80"> </td>
<td align="left" valign="top" bgcolor="#cccccc" width="363"> </td>
<td align="left" valign="top" bgcolor="#cccccc" width="95"> </td>
</tr>
<tr>
<td class="beschr_hell" align="left" valign="top" bgcolor="#999999" width="80">Text</td>
<td colspan="2" align="left" valign="top" bgcolor="#cccccc" width="462">
<p class="fliesstext"><?php echo $datensatz["Text"]; ?></p>
</td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#999999" width="80"> </td>
<td align="left" valign="top" bgcolor="#cccccc" width="363"> </td>
<td align="left" valign="top" bgcolor="#cccccc" width="95"> </td>
</tr>
<tr>
<td align="left" valign="top" width="80"> </td>
<td align="left" valign="top" width="363"> </td>
<td align="left" valign="top" width="95"> </td>
</tr>
<?php
}
?>
<tr>
<td align="left" valign="top" bgcolor="#999999" width="80">
<?php
if ( $seite != 1 )
{
?>
<a href="<?php echo $_REQUEST["PHP_SELF"]; ?>?seite=<?php echo $seite - 1; ?>">zurück</a>
<?php
}
?>
</td>
<td align="center" valign="top" bgcolor="#cccccc" width="363">Seite <?php echo $seite; ?> von <?php echo $seitengesamt; ?></td>
<td align="right" valign="top" bgcolor="#cccccc" width="95">
<?php
if ( ( $seite +1 ) <= $seitengesamt )
{
?>
<a href="<?php echo $_REQUEST["PHP_SELF"]; ?>?seite=<?php echo $seite + 1; ?>">weiter</a>
<?php
}
?>
</td>
</tr>
</table>
<p></p>
<p></p>
</body>
</html>