PHP-Code:
<?
include "config.php";
if ($_GET['module'] == "news" && !isset($_GET['id']) && !isset($_GET['module'])) {
echo "News\n
";
$sql = "
SELECT
Titel,
Inhalt,
Datum
FROM
News
ORDER BY
ID DESC
LIMIT 5
";
$result = mysql_query($sql) OR die(mysql_error());
if(mysql_num_rows($result)) {
while($row = mysql_fetch_assoc($result)) {
echo "<table width=\"50%\" border=\"0\">";
echo "<tr valign=\"top\">";
echo "<td height=\"25\">";
echo "[b]";
echo $row['Titel'];
echo "[/b]";
echo "</td> ";
echo "<td align=\"right\">";
echo date("d.m.Y ", $row['Datum']); // Datum
echo date("H:i", $row['Datum']); // Uhrzeit
echo "</td> ";
echo " </tr> ";
echo " <tr> ";
echo " <td colspan=\"3\"> ";
echo nl2br($row['Inhalt']);
echo "</td> ";
echo " </tr> ";
echo " <tr> ";
echo " <td colspan=\"3\" td align=\"right\"> ";
echo "
";
echo "news posted by [ test ]</td> ";
echo " </tr> ";
echo "
";
}
} else {
echo"
Keine News vorhanden</p>\n";
}
mysql_close($db);
echo "</table> ";
}
if ($_GET['module'] == "news" && isset($_GET['id'])) {
include "config.php";
echo "News\n
";
$sql = "SELECT
Titel,
Inhalt,
Datum
FROM
News
WHERE ID = $id
";
$result = mysql_query($sql) OR die(mysql_error());
if(mysql_num_rows($result)) {
while($row = mysql_fetch_assoc($result)) {
echo "<table width=\"50%\" border=\"0\">";
echo "<tr valign=\"top\">";
echo "<td height=\"25\">";
echo "[b]";
echo $row['Titel'];
echo "[/b]";
echo "</td> ";
echo "<td align=\"right\">";
echo date("d.m.Y ", $row['datum']); // Datum
echo date("H:i", $row['datum']); // Uhrzeit
echo "</td> ";
echo " </tr> ";
echo " <tr> ";
echo " <td colspan=\"3\"> ";
echo nl2br($row['Inhalt']);
echo "</td> ";
echo " </tr> ";
echo " <tr> ";
echo " <td colspan=\"3\" td align=\"right\"> ";
echo "
";
echo "news posted by [ test ]</td> ";
echo " </tr> ";
}
} else {
echo"
Keine News vorhanden</p>\n";
}
mysql_close($db);
echo "</table>";
}
if ($_GET['module'] == "news" && isset($_GET['archiv'])) {
echo "</table>";
echo "<table width=\"50%\" border=\"0\">";
echo "<tr> ";
echo " <td>Nummer</td> ";
echo "<td>Titel</td> ";
echo " <td>Datum</td> ";
echo " </tr> ";
include "config.php";
echo "News Archiv\n
";
$sql = "SELECT
ID,
Titel,
Datum
FROM
News
ORDER BY
id DESC";
$result = mysql_query($sql) OR die(mysql_error());
if(mysql_num_rows($result)) {
while($row = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<td>";
echo "<a href=\"?module=news&id=".$row['ID']."\">";
echo $row['ID'];
echo "</a>";
echo "</td>";
echo "<td>";
echo $row['Titel'];
echo "</td>";
echo "<td>";
echo date("d.m.Y ", $row['datum']); // Datum
echo date("H:i", $row['datum']); // Uhrzeit
echo "</td>";
echo "</tr>";
}
} else {
echo"
Keine News vorhanden</p>\n";
}
mysql_close($db);
echo "</table>";
}
?>
Hm nun funken module und die id ausgabe nur er zeigt mir bei ?module=news nicht die news an -.-