ich habe hier ein news script das in einer while schleife leuft und einmal eine durchnummerrierung jeweils vor jeder news bis zu 5 das heiss das vor jeder news <a name="5"></a> mit abfallender zahl steht soweit so gut
nur habe ich jetzt das problem das jede news dopelt kommt weil sie beide while schleifen durchgeht wie kann ich das ändern?
nur habe ich jetzt das problem das jede news dopelt kommt weil sie beide while schleifen durchgeht wie kann ich das ändern?
PHP:
mysql_select_db("$db_db");
$abfrage = mysql_query("select name, email, topic, img, text, unix_timestamp(time) from news order by time desc limit 10");
while (list($name, $email, $topic, $img, $text, $zeit) = mysql_fetch_row ($abfrage))
{
$datum = date ("d.m.Y" , $zeit);
$uhrzeit = date ("H:i", $zeit);
$news = "";
$news = nl2br($text);
?>
<?php $x=5; while(0 < $x) { echo("<a name='".$x."'></a>\n"); $x--; ?>
<table cellpadding="5" cellspacing="0" class="news" width="600" border="0" align="left">
<tr><td background="img/newso.jpg" height="32" width="600" leftmargin="0" topmargin="0" cellpadding="0" cellspacing="0"></td></tr>
<tr><td width="600" leftmargin="0" topmargin="0" cellpadding="0" cellspacing="0"><img src="img/<? echo $img ?>"><font size="12px"></br><b><? echo "$topic"; ?></font></b></br></br><font size="12px"> <? echo "$news"; ?></font></td></tr>
<tr><td background="img/newsu.jpg" height="28" width="600" leftmargin="0" topmargin="0" cellpadding="0" cellspacing="0"><font size="2"> <? echo "$datum $uhrzeit"; ?> von<font size="2" color="#336699"> <? echo " | <a href='mailto:$email'>$name</A>"; ?> </font> </td></tr>
</table></br>
<?
}
?>
<?
}
?>