<?
include("sqlfileedit.php");
$sql = "select
beitraege.`id`,
beitraege.`ueberschrift`,
beitraege.`text`,
beitraege.`filename`,
beitraege.`name`,
beitraege.`imgtext`,
count(commentbe.beid) as anzahlKommentare
from beitraege
left join commentbe
on commentbe.beid=beitraege.id
group by beitraege.id
order by beitraege.id desc";
$ergebnis = mysql_query($sql) or die (mysql_error());
while($row = mysql_fetch_object($ergebnis)) {
$id = $row->id;
$ueberschrift = $row->ueberschrift;
$text = $row->text;
$filename = $row->filename;
$name = $row->name;
$imgtext = $row->imgtext;
$anz = $row->anzahlKommentare;
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo " <tr>";
echo " <td>";
echo " <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo " <tr>";
echo " <td><h3>$ueberschrift</h3></td>";
echo " </tr>";
echo " </table></td>";
echo " </tr>";
echo " <tr>";
echo " <td valign=\"top\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo " <tr>";
echo " <td valign=\"top\"><table border=\"0\" align=\"left\" cellpadding=\"0\" cellspacing=\"0\">";
echo " <tr>";
echo " <td class=\"small\"><img src=\"beitraege/images/$filename\" alt=\"$imgtext\"></td>";
echo " <td width=\"3\" class=\"small\"><img src=\"../../images/spacer.gif\" width=\"3\" height=\"3\"></td>";
echo " </tr>";
echo " <tr>";
echo " <td class=\"small\">$imgtext</td>";
echo " <td width=\"3\" class=\"small\"><img src=\"../../images/spacer.gif\" width=\"3\" height=\"3\"></td>";
echo " </tr>";
echo " <tr>";
echo " <td height=\"3\" class=\"small\"><img src=\"../../images/spacer.gif\" width=\"3\" height=\"3\"></td>";
echo " <td width=\"3\" height=\"3\" class=\"small\"><img src=\"../../images/spacer.gif\" width=\"3\" height=\"3\"></td>";
echo " </tr>";
echo " </table>";
echo " $text</td>";
echo " </tr>";
echo " <tr>";
echo " <td align=\"right\" valign=\"top\"><span class=\"small\"><a href=\"index.php?section=commentbe&id=$id\">$anz Kommentare</a></span></td>";
echo " </tr>";
echo " </table></td>";
echo " </tr>";
echo " <tr>";
echo " <td height=\"10\" align=\"right\" valign=\"top\"><img src=\"../../images/spacer.gif\" width=\"1\" height=\"10\"></td>";
echo " </tr>";
echo " <tr>";
echo " <td height=\"1\" valign=\"top\" bgcolor=\"716D52\"><span class=\"small\"><img src=\"../../images/spacer.gif\" width=\"1\" height=\"1\"></span></td>";
echo " </tr>";
echo " <tr>";
echo " <td height=\"10\" valign=\"top\"><img src=\"../../images/spacer.gif\" width=\"1\" height=\"10\"></td>";
echo " </tr>";
echo "</table>";
}
?>